@@ -3,14 +3,14 @@ use crate::errors::{
33 CountRepetitionMisplaced , MetaVarExprUnrecognizedVar , MetaVarsDifSeqMatchers , MustRepeatOnce ,
44 NoSyntaxVarsExprRepeat , VarStillRepeating ,
55} ;
6- use crate :: mbe:: macro_parser:: { MatchedNonterminal , MatchedSeq , MatchedTokenTree , NamedMatch } ;
6+ use crate :: mbe:: macro_parser:: { NamedMatch , NamedMatch :: * } ;
77use crate :: mbe:: { self , KleeneOp , MetaVarExpr } ;
88use rustc_ast:: mut_visit:: { self , MutVisitor } ;
99use rustc_ast:: token:: { self , Delimiter , Token , TokenKind } ;
1010use rustc_ast:: tokenstream:: { DelimSpacing , DelimSpan , Spacing , TokenStream , TokenTree } ;
1111use rustc_data_structures:: fx:: FxHashMap ;
12- use rustc_errors:: Diag ;
13- use rustc_errors :: { pluralize , PResult } ;
12+ use rustc_errors:: { pluralize , Diag , PResult } ;
13+ use rustc_parse :: parser :: ParseNtResult ;
1414use rustc_span:: hygiene:: { LocalExpnId , Transparency } ;
1515use rustc_span:: symbol:: { sym, Ident , MacroRulesNormalizedIdent } ;
1616use rustc_span:: { with_metavar_spans, Span , SyntaxContext } ;
@@ -251,12 +251,12 @@ pub(super) fn transcribe<'a>(
251251 let ident = MacroRulesNormalizedIdent :: new ( original_ident) ;
252252 if let Some ( cur_matched) = lookup_cur_matched ( ident, interp, & repeats) {
253253 let tt = match cur_matched {
254- MatchedTokenTree ( tt ) => {
254+ MatchedSingle ( ParseNtResult :: Tt ( tt ) ) => {
255255 // `tt`s are emitted into the output stream directly as "raw tokens",
256256 // without wrapping them into groups.
257257 maybe_use_metavar_location ( cx, & stack, sp, tt, & mut marker)
258258 }
259- MatchedNonterminal ( nt ) => {
259+ MatchedSingle ( ParseNtResult :: Nt ( nt ) ) => {
260260 // Other variables are emitted into the output stream as groups with
261261 // `Delimiter::Invisible` to maintain parsing priorities.
262262 // `Interpolated` is currently used for such groups in rustc parser.
@@ -423,7 +423,7 @@ fn lookup_cur_matched<'a>(
423423 interpolations. get ( & ident) . map ( |mut matched| {
424424 for & ( idx, _) in repeats {
425425 match matched {
426- MatchedTokenTree ( _ ) | MatchedNonterminal ( _) => break ,
426+ MatchedSingle ( _) => break ,
427427 MatchedSeq ( ads) => matched = ads. get ( idx) . unwrap ( ) ,
428428 }
429429 }
@@ -513,7 +513,7 @@ fn lockstep_iter_size(
513513 let name = MacroRulesNormalizedIdent :: new ( * name) ;
514514 match lookup_cur_matched ( name, interpolations, repeats) {
515515 Some ( matched) => match matched {
516- MatchedTokenTree ( _ ) | MatchedNonterminal ( _) => LockstepIterSize :: Unconstrained ,
516+ MatchedSingle ( _) => LockstepIterSize :: Unconstrained ,
517517 MatchedSeq ( ads) => LockstepIterSize :: Constraint ( ads. len ( ) , name) ,
518518 } ,
519519 _ => LockstepIterSize :: Unconstrained ,
@@ -556,7 +556,7 @@ fn count_repetitions<'a>(
556556 // (or at the top-level of `matched` if no depth is given).
557557 fn count < ' a > ( depth_curr : usize , depth_max : usize , matched : & NamedMatch ) -> PResult < ' a , usize > {
558558 match matched {
559- MatchedTokenTree ( _ ) | MatchedNonterminal ( _) => Ok ( 1 ) ,
559+ MatchedSingle ( _) => Ok ( 1 ) ,
560560 MatchedSeq ( named_matches) => {
561561 if depth_curr == depth_max {
562562 Ok ( named_matches. len ( ) )
@@ -570,7 +570,7 @@ fn count_repetitions<'a>(
570570 /// Maximum depth
571571 fn depth ( counter : usize , matched : & NamedMatch ) -> usize {
572572 match matched {
573- MatchedTokenTree ( _ ) | MatchedNonterminal ( _) => counter,
573+ MatchedSingle ( _) => counter,
574574 MatchedSeq ( named_matches) => {
575575 let rslt = counter + 1 ;
576576 if let Some ( elem) = named_matches. first ( ) { depth ( rslt, elem) } else { rslt }
@@ -598,7 +598,7 @@ fn count_repetitions<'a>(
598598 }
599599 }
600600
601- if let MatchedTokenTree ( _ ) | MatchedNonterminal ( _) = matched {
601+ if let MatchedSingle ( _) = matched {
602602 return Err ( cx. dcx ( ) . create_err ( CountRepetitionMisplaced { span : sp. entire ( ) } ) ) ;
603603 }
604604
0 commit comments