@@ -401,7 +401,7 @@ pub fn compile_declarative_macro(
401401 let diag = & sess. parse_sess . span_diagnostic ;
402402 let lhs_nm = Ident :: new ( sym:: lhs, def. span ) ;
403403 let rhs_nm = Ident :: new ( sym:: rhs, def. span ) ;
404- let tt_spec = NonterminalKind :: TT ;
404+ let tt_spec = Some ( NonterminalKind :: TT ) ;
405405
406406 // Parse the macro_rules! invocation
407407 let ( macro_rules, body) = match & def. kind {
@@ -578,7 +578,7 @@ fn check_lhs_no_empty_seq(sess: &ParseSess, tts: &[mbe::TokenTree]) -> bool {
578578 TokenTree :: Sequence ( span, ref seq) => {
579579 if seq. separator . is_none ( )
580580 && seq. tts . iter ( ) . all ( |seq_tt| match * seq_tt {
581- TokenTree :: MetaVarDecl ( _, _, NonterminalKind :: Vis ) => true ,
581+ TokenTree :: MetaVarDecl ( _, _, Some ( NonterminalKind :: Vis ) ) => true ,
582582 TokenTree :: Sequence ( _, ref sub_seq) => {
583583 sub_seq. kleene . op == mbe:: KleeneOp :: ZeroOrMore
584584 || sub_seq. kleene . op == mbe:: KleeneOp :: ZeroOrOne
@@ -961,7 +961,7 @@ fn check_matcher_core(
961961 // Now `last` holds the complete set of NT tokens that could
962962 // end the sequence before SUFFIX. Check that every one works with `suffix`.
963963 for token in & last. tokens {
964- if let TokenTree :: MetaVarDecl ( _, name, kind) = * token {
964+ if let TokenTree :: MetaVarDecl ( _, name, Some ( kind) ) = * token {
965965 for next_token in & suffix_first. tokens {
966966 match is_in_follow ( next_token, kind) {
967967 IsInFollow :: Yes => { }
@@ -1019,7 +1019,7 @@ fn check_matcher_core(
10191019}
10201020
10211021fn token_can_be_followed_by_any ( tok : & mbe:: TokenTree ) -> bool {
1022- if let mbe:: TokenTree :: MetaVarDecl ( _, _, kind) = * tok {
1022+ if let mbe:: TokenTree :: MetaVarDecl ( _, _, Some ( kind) ) = * tok {
10231023 frag_can_be_followed_by_any ( kind)
10241024 } else {
10251025 // (Non NT's can always be followed by anything in matchers.)
@@ -1123,7 +1123,7 @@ fn is_in_follow(tok: &mbe::TokenTree, kind: NonterminalKind) -> IsInFollow {
11231123 }
11241124 _ => IsInFollow :: No ( TOKENS ) ,
11251125 } ,
1126- TokenTree :: MetaVarDecl ( _, _, NonterminalKind :: Block ) => IsInFollow :: Yes ,
1126+ TokenTree :: MetaVarDecl ( _, _, Some ( NonterminalKind :: Block ) ) => IsInFollow :: Yes ,
11271127 _ => IsInFollow :: No ( TOKENS ) ,
11281128 }
11291129 }
@@ -1158,7 +1158,7 @@ fn is_in_follow(tok: &mbe::TokenTree, kind: NonterminalKind) -> IsInFollow {
11581158 TokenTree :: MetaVarDecl (
11591159 _,
11601160 _,
1161- NonterminalKind :: Ident | NonterminalKind :: Ty | NonterminalKind :: Path ,
1161+ Some ( NonterminalKind :: Ident | NonterminalKind :: Ty | NonterminalKind :: Path ) ,
11621162 ) => IsInFollow :: Yes ,
11631163 _ => IsInFollow :: No ( TOKENS ) ,
11641164 }
@@ -1171,7 +1171,8 @@ fn quoted_tt_to_string(tt: &mbe::TokenTree) -> String {
11711171 match * tt {
11721172 mbe:: TokenTree :: Token ( ref token) => pprust:: token_to_string ( & token) ,
11731173 mbe:: TokenTree :: MetaVar ( _, name) => format ! ( "${}" , name) ,
1174- mbe:: TokenTree :: MetaVarDecl ( _, name, kind) => format ! ( "${}:{}" , name, kind) ,
1174+ mbe:: TokenTree :: MetaVarDecl ( _, name, Some ( kind) ) => format ! ( "${}:{}" , name, kind) ,
1175+ mbe:: TokenTree :: MetaVarDecl ( _, name, None ) => format ! ( "${}:" , name) ,
11751176 _ => panic ! (
11761177 "{}" ,
11771178 "unexpected mbe::TokenTree::{Sequence or Delimited} \
0 commit comments