@@ -435,7 +435,7 @@ pub fn compile_declarative_macro(
435
435
) ,
436
436
] ;
437
437
// Convert it into `MatcherLoc` form.
438
- let argument_gram = mbe:: macro_parser:: compute_locs ( & sess . parse_sess , & argument_gram) ;
438
+ let argument_gram = mbe:: macro_parser:: compute_locs ( & argument_gram) ;
439
439
440
440
let parser = Parser :: new ( & sess. parse_sess , body, true , rustc_parse:: MACRO_ARGUMENTS ) ;
441
441
let mut tt_parser =
@@ -478,7 +478,7 @@ pub fn compile_declarative_macro(
478
478
)
479
479
. pop ( )
480
480
. unwrap ( ) ;
481
- valid &= check_lhs_nt_follows ( & sess. parse_sess , features , & def, & tt) ;
481
+ valid &= check_lhs_nt_follows ( & sess. parse_sess , & def, & tt) ;
482
482
return tt;
483
483
}
484
484
sess. parse_sess . span_diagnostic . span_bug ( def. span , "wrong-structured lhs" )
@@ -540,7 +540,7 @@ pub fn compile_declarative_macro(
540
540
// Ignore the delimiters around the matcher.
541
541
match lhs {
542
542
mbe:: TokenTree :: Delimited ( _, delimited) => {
543
- mbe:: macro_parser:: compute_locs ( & sess . parse_sess , & delimited. tts )
543
+ mbe:: macro_parser:: compute_locs ( & delimited. tts )
544
544
}
545
545
_ => sess. parse_sess . span_diagnostic . span_bug ( def. span , "malformed macro lhs" ) ,
546
546
}
@@ -563,16 +563,11 @@ pub fn compile_declarative_macro(
563
563
} ) )
564
564
}
565
565
566
- fn check_lhs_nt_follows (
567
- sess : & ParseSess ,
568
- features : & Features ,
569
- def : & ast:: Item ,
570
- lhs : & mbe:: TokenTree ,
571
- ) -> bool {
566
+ fn check_lhs_nt_follows ( sess : & ParseSess , def : & ast:: Item , lhs : & mbe:: TokenTree ) -> bool {
572
567
// lhs is going to be like TokenTree::Delimited(...), where the
573
568
// entire lhs is those tts. Or, it can be a "bare sequence", not wrapped in parens.
574
569
if let mbe:: TokenTree :: Delimited ( _, delimited) = lhs {
575
- check_matcher ( sess, features , def, & delimited. tts )
570
+ check_matcher ( sess, def, & delimited. tts )
576
571
} else {
577
572
let msg = "invalid macro matcher; matchers must be contained in balanced delimiters" ;
578
573
sess. span_diagnostic . span_err ( lhs. span ( ) , msg) ;
@@ -632,16 +627,11 @@ fn check_rhs(sess: &ParseSess, rhs: &mbe::TokenTree) -> bool {
632
627
false
633
628
}
634
629
635
- fn check_matcher (
636
- sess : & ParseSess ,
637
- features : & Features ,
638
- def : & ast:: Item ,
639
- matcher : & [ mbe:: TokenTree ] ,
640
- ) -> bool {
630
+ fn check_matcher ( sess : & ParseSess , def : & ast:: Item , matcher : & [ mbe:: TokenTree ] ) -> bool {
641
631
let first_sets = FirstSets :: new ( matcher) ;
642
632
let empty_suffix = TokenSet :: empty ( ) ;
643
633
let err = sess. span_diagnostic . err_count ( ) ;
644
- check_matcher_core ( sess, features , def, & first_sets, matcher, & empty_suffix) ;
634
+ check_matcher_core ( sess, def, & first_sets, matcher, & empty_suffix) ;
645
635
err == sess. span_diagnostic . err_count ( )
646
636
}
647
637
@@ -955,7 +945,6 @@ impl<'tt> TokenSet<'tt> {
955
945
// see `FirstSets::new`.
956
946
fn check_matcher_core < ' tt > (
957
947
sess : & ParseSess ,
958
- features : & Features ,
959
948
def : & ast:: Item ,
960
949
first_sets : & FirstSets < ' tt > ,
961
950
matcher : & ' tt [ mbe:: TokenTree ] ,
@@ -1008,7 +997,7 @@ fn check_matcher_core<'tt>(
1008
997
token:: CloseDelim ( d. delim ) ,
1009
998
span. close ,
1010
999
) ) ;
1011
- check_matcher_core ( sess, features , def, first_sets, & d. tts , & my_suffix) ;
1000
+ check_matcher_core ( sess, def, first_sets, & d. tts , & my_suffix) ;
1012
1001
// don't track non NT tokens
1013
1002
last. replace_with_irrelevant ( ) ;
1014
1003
@@ -1040,8 +1029,7 @@ fn check_matcher_core<'tt>(
1040
1029
// At this point, `suffix_first` is built, and
1041
1030
// `my_suffix` is some TokenSet that we can use
1042
1031
// for checking the interior of `seq_rep`.
1043
- let next =
1044
- check_matcher_core ( sess, features, def, first_sets, & seq_rep. tts , my_suffix) ;
1032
+ let next = check_matcher_core ( sess, def, first_sets, & seq_rep. tts , my_suffix) ;
1045
1033
if next. maybe_empty {
1046
1034
last. add_all ( & next) ;
1047
1035
} else {
0 commit comments