@@ -55,8 +55,6 @@ pub(crate) struct ParserAnyMacro<'a> {
5555 arm_span : Span ,
5656 /// Whether or not this macro is defined in the current crate
5757 is_local : bool ,
58- bindings : Vec < Ident > ,
59- matched_rule_bindings : Vec < Ident > ,
6058}
6159
6260impl < ' a > ParserAnyMacro < ' a > {
@@ -69,22 +67,13 @@ impl<'a> ParserAnyMacro<'a> {
6967 arm_span,
7068 is_trailing_mac,
7169 is_local,
72- bindings,
73- matched_rule_bindings,
7470 } = * self ;
7571 let snapshot = & mut parser. create_snapshot_for_diagnostic ( ) ;
7672 let fragment = match parse_ast_fragment ( parser, kind) {
7773 Ok ( f) => f,
7874 Err ( err) => {
7975 let guar = diagnostics:: emit_frag_parse_err (
80- err,
81- parser,
82- snapshot,
83- site_span,
84- arm_span,
85- kind,
86- bindings,
87- matched_rule_bindings,
76+ err, parser, snapshot, site_span, arm_span, kind,
8877 ) ;
8978 return kind. dummy ( site_span, guar) ;
9079 }
@@ -119,9 +108,6 @@ impl<'a> ParserAnyMacro<'a> {
119108 arm_span : Span ,
120109 is_local : bool ,
121110 macro_ident : Ident ,
122- // bindings and lhs is for diagnostics
123- bindings : Vec < Ident > ,
124- matched_rule_bindings : Vec < Ident > ,
125111 ) -> Self {
126112 Self {
127113 parser : Parser :: new ( & cx. sess . psess , tts, None ) ,
@@ -135,8 +121,6 @@ impl<'a> ParserAnyMacro<'a> {
135121 is_trailing_mac : cx. current_expansion . is_trailing_mac ,
136122 arm_span,
137123 is_local,
138- bindings,
139- matched_rule_bindings,
140124 }
141125 }
142126}
@@ -375,7 +359,7 @@ fn expand_macro<'cx>(
375359
376360 match try_success_result {
377361 Ok ( ( rule_index, rule, named_matches) ) => {
378- let MacroRule :: Func { lhs , rhs, .. } = rule else {
362+ let MacroRule :: Func { rhs, .. } = rule else {
379363 panic ! ( "try_match_macro returned non-func rule" ) ;
380364 } ;
381365 let mbe:: TokenTree :: Delimited ( rhs_span, _, rhs) = rhs else {
@@ -403,32 +387,8 @@ fn expand_macro<'cx>(
403387 cx. resolver . record_macro_rule_usage ( node_id, rule_index) ;
404388 }
405389
406- let mut bindings = vec ! [ ] ;
407- for rule in rules {
408- let MacroRule :: Func { lhs, .. } = rule else { continue } ;
409- for param in lhs {
410- let MatcherLoc :: MetaVarDecl { bind, .. } = param else { continue } ;
411- bindings. push ( * bind) ;
412- }
413- }
414-
415- let mut matched_rule_bindings = vec ! [ ] ;
416- for param in lhs {
417- let MatcherLoc :: MetaVarDecl { bind, .. } = param else { continue } ;
418- matched_rule_bindings. push ( * bind) ;
419- }
420-
421390 // Let the context choose how to interpret the result. Weird, but useful for X-macros.
422- Box :: new ( ParserAnyMacro :: from_tts (
423- cx,
424- tts,
425- sp,
426- arm_span,
427- is_local,
428- name,
429- bindings,
430- matched_rule_bindings,
431- ) )
391+ Box :: new ( ParserAnyMacro :: from_tts ( cx, tts, sp, arm_span, is_local, name) )
432392 }
433393 Err ( CanRetry :: No ( guar) ) => {
434394 debug ! ( "Will not retry matching as an error was emitted already" ) ;
0 commit comments