@@ -401,7 +401,7 @@ pub fn compile_declarative_macro(
401
401
let diag = & sess. parse_sess . span_diagnostic ;
402
402
let lhs_nm = Ident :: new ( sym:: lhs, def. span ) ;
403
403
let rhs_nm = Ident :: new ( sym:: rhs, def. span ) ;
404
- let tt_spec = NonterminalKind :: TT ;
404
+ let tt_spec = Some ( NonterminalKind :: TT ) ;
405
405
406
406
// Parse the macro_rules! invocation
407
407
let ( macro_rules, body) = match & def. kind {
@@ -578,7 +578,7 @@ fn check_lhs_no_empty_seq(sess: &ParseSess, tts: &[mbe::TokenTree]) -> bool {
578
578
TokenTree :: Sequence ( span, ref seq) => {
579
579
if seq. separator . is_none ( )
580
580
&& seq. tts . iter ( ) . all ( |seq_tt| match * seq_tt {
581
- TokenTree :: MetaVarDecl ( _, _, NonterminalKind :: Vis ) => true ,
581
+ TokenTree :: MetaVarDecl ( _, _, Some ( NonterminalKind :: Vis ) ) => true ,
582
582
TokenTree :: Sequence ( _, ref sub_seq) => {
583
583
sub_seq. kleene . op == mbe:: KleeneOp :: ZeroOrMore
584
584
|| sub_seq. kleene . op == mbe:: KleeneOp :: ZeroOrOne
@@ -961,7 +961,7 @@ fn check_matcher_core(
961
961
// Now `last` holds the complete set of NT tokens that could
962
962
// end the sequence before SUFFIX. Check that every one works with `suffix`.
963
963
for token in & last. tokens {
964
- if let TokenTree :: MetaVarDecl ( _, name, kind) = * token {
964
+ if let TokenTree :: MetaVarDecl ( _, name, Some ( kind) ) = * token {
965
965
for next_token in & suffix_first. tokens {
966
966
match is_in_follow ( next_token, kind) {
967
967
IsInFollow :: Yes => { }
@@ -1019,7 +1019,7 @@ fn check_matcher_core(
1019
1019
}
1020
1020
1021
1021
fn 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 {
1023
1023
frag_can_be_followed_by_any ( kind)
1024
1024
} else {
1025
1025
// (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 {
1123
1123
}
1124
1124
_ => IsInFollow :: No ( TOKENS ) ,
1125
1125
} ,
1126
- TokenTree :: MetaVarDecl ( _, _, NonterminalKind :: Block ) => IsInFollow :: Yes ,
1126
+ TokenTree :: MetaVarDecl ( _, _, Some ( NonterminalKind :: Block ) ) => IsInFollow :: Yes ,
1127
1127
_ => IsInFollow :: No ( TOKENS ) ,
1128
1128
}
1129
1129
}
@@ -1158,7 +1158,7 @@ fn is_in_follow(tok: &mbe::TokenTree, kind: NonterminalKind) -> IsInFollow {
1158
1158
TokenTree :: MetaVarDecl (
1159
1159
_,
1160
1160
_,
1161
- NonterminalKind :: Ident | NonterminalKind :: Ty | NonterminalKind :: Path ,
1161
+ Some ( NonterminalKind :: Ident | NonterminalKind :: Ty | NonterminalKind :: Path ) ,
1162
1162
) => IsInFollow :: Yes ,
1163
1163
_ => IsInFollow :: No ( TOKENS ) ,
1164
1164
}
@@ -1171,7 +1171,8 @@ fn quoted_tt_to_string(tt: &mbe::TokenTree) -> String {
1171
1171
match * tt {
1172
1172
mbe:: TokenTree :: Token ( ref token) => pprust:: token_to_string ( & token) ,
1173
1173
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) ,
1175
1176
_ => panic ! (
1176
1177
"{}" ,
1177
1178
"unexpected mbe::TokenTree::{Sequence or Delimited} \
0 commit comments