@@ -3,14 +3,14 @@ use crate::errors::{
3
3
CountRepetitionMisplaced , MetaVarExprUnrecognizedVar , MetaVarsDifSeqMatchers , MustRepeatOnce ,
4
4
NoSyntaxVarsExprRepeat , VarStillRepeating ,
5
5
} ;
6
- use crate :: mbe:: macro_parser:: { MatchedNonterminal , MatchedSeq , MatchedTokenTree , NamedMatch } ;
6
+ use crate :: mbe:: macro_parser:: { NamedMatch , NamedMatch :: * } ;
7
7
use crate :: mbe:: { self , KleeneOp , MetaVarExpr } ;
8
8
use rustc_ast:: mut_visit:: { self , MutVisitor } ;
9
9
use rustc_ast:: token:: { self , Delimiter , Token , TokenKind } ;
10
10
use rustc_ast:: tokenstream:: { DelimSpacing , DelimSpan , Spacing , TokenStream , TokenTree } ;
11
11
use 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 ;
14
14
use rustc_span:: hygiene:: { LocalExpnId , Transparency } ;
15
15
use rustc_span:: symbol:: { sym, Ident , MacroRulesNormalizedIdent } ;
16
16
use rustc_span:: { with_metavar_spans, Span , SyntaxContext } ;
@@ -251,12 +251,12 @@ pub(super) fn transcribe<'a>(
251
251
let ident = MacroRulesNormalizedIdent :: new ( original_ident) ;
252
252
if let Some ( cur_matched) = lookup_cur_matched ( ident, interp, & repeats) {
253
253
let tt = match cur_matched {
254
- MatchedTokenTree ( tt ) => {
254
+ MatchedSingle ( ParseNtResult :: Tt ( tt ) ) => {
255
255
// `tt`s are emitted into the output stream directly as "raw tokens",
256
256
// without wrapping them into groups.
257
257
maybe_use_metavar_location ( cx, & stack, sp, tt, & mut marker)
258
258
}
259
- MatchedNonterminal ( nt ) => {
259
+ MatchedSingle ( ParseNtResult :: Nt ( nt ) ) => {
260
260
// Other variables are emitted into the output stream as groups with
261
261
// `Delimiter::Invisible` to maintain parsing priorities.
262
262
// `Interpolated` is currently used for such groups in rustc parser.
@@ -423,7 +423,7 @@ fn lookup_cur_matched<'a>(
423
423
interpolations. get ( & ident) . map ( |mut matched| {
424
424
for & ( idx, _) in repeats {
425
425
match matched {
426
- MatchedTokenTree ( _ ) | MatchedNonterminal ( _) => break ,
426
+ MatchedSingle ( _) => break ,
427
427
MatchedSeq ( ads) => matched = ads. get ( idx) . unwrap ( ) ,
428
428
}
429
429
}
@@ -513,7 +513,7 @@ fn lockstep_iter_size(
513
513
let name = MacroRulesNormalizedIdent :: new ( * name) ;
514
514
match lookup_cur_matched ( name, interpolations, repeats) {
515
515
Some ( matched) => match matched {
516
- MatchedTokenTree ( _ ) | MatchedNonterminal ( _) => LockstepIterSize :: Unconstrained ,
516
+ MatchedSingle ( _) => LockstepIterSize :: Unconstrained ,
517
517
MatchedSeq ( ads) => LockstepIterSize :: Constraint ( ads. len ( ) , name) ,
518
518
} ,
519
519
_ => LockstepIterSize :: Unconstrained ,
@@ -556,7 +556,7 @@ fn count_repetitions<'a>(
556
556
// (or at the top-level of `matched` if no depth is given).
557
557
fn count < ' a > ( depth_curr : usize , depth_max : usize , matched : & NamedMatch ) -> PResult < ' a , usize > {
558
558
match matched {
559
- MatchedTokenTree ( _ ) | MatchedNonterminal ( _) => Ok ( 1 ) ,
559
+ MatchedSingle ( _) => Ok ( 1 ) ,
560
560
MatchedSeq ( named_matches) => {
561
561
if depth_curr == depth_max {
562
562
Ok ( named_matches. len ( ) )
@@ -570,7 +570,7 @@ fn count_repetitions<'a>(
570
570
/// Maximum depth
571
571
fn depth ( counter : usize , matched : & NamedMatch ) -> usize {
572
572
match matched {
573
- MatchedTokenTree ( _ ) | MatchedNonterminal ( _) => counter,
573
+ MatchedSingle ( _) => counter,
574
574
MatchedSeq ( named_matches) => {
575
575
let rslt = counter + 1 ;
576
576
if let Some ( elem) = named_matches. first ( ) { depth ( rslt, elem) } else { rslt }
@@ -598,7 +598,7 @@ fn count_repetitions<'a>(
598
598
}
599
599
}
600
600
601
- if let MatchedTokenTree ( _ ) | MatchedNonterminal ( _) = matched {
601
+ if let MatchedSingle ( _) = matched {
602
602
return Err ( cx. dcx ( ) . create_err ( CountRepetitionMisplaced { span : sp. entire ( ) } ) ) ;
603
603
}
604
604
0 commit comments