@@ -532,8 +532,7 @@ impl Token {
532532 Pound => true , // expression attributes
533533 Interpolated ( ref nt) => matches ! ( & * * nt, NtLiteral ( ..) |
534534 NtExpr ( ..) |
535- NtBlock ( ..) |
536- NtPath ( ..) ) ,
535+ NtBlock ( ..) ) ,
537536 OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
538537 NonterminalKind :: Block |
539538 NonterminalKind :: Expr |
@@ -560,9 +559,7 @@ impl Token {
560559 | DotDot | DotDotDot | DotDotEq // ranges
561560 | Lt | BinOp ( Shl ) // associated path
562561 | PathSep => true , // global path
563- Interpolated ( ref nt) => matches ! ( & * * nt, NtLiteral ( ..) |
564- NtBlock ( ..) |
565- NtPath ( ..) ) ,
562+ Interpolated ( ref nt) => matches ! ( & * * nt, NtLiteral ( ..) | NtBlock ( ..) ) ,
566563 OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
567564 NonterminalKind :: Block |
568565 NonterminalKind :: PatParam { .. } |
@@ -589,7 +586,6 @@ impl Token {
589586 Lifetime ( ..) | // lifetime bound in trait object
590587 Lt | BinOp ( Shl ) | // associated path
591588 PathSep => true , // global path
592- Interpolated ( ref nt) => matches ! ( & * * nt, NtPath ( ..) ) ,
593589 OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
594590 NonterminalKind :: Ty |
595591 NonterminalKind :: Path
@@ -721,29 +717,20 @@ impl Token {
721717 self . ident ( ) . is_some_and ( |( ident, _) | ident. name == name)
722718 }
723719
724- /// Returns `true` if the token is an interpolated path.
725- fn is_whole_path ( & self ) -> bool {
726- if let Interpolated ( nt) = & self . kind
727- && let NtPath ( ..) = & * * nt
728- {
729- return true ;
730- }
731-
732- false
733- }
734-
735720 /// Would `maybe_whole_expr` in `parser.rs` return `Ok(..)`?
736721 /// That is, is this a pre-parsed expression dropped into the token stream
737722 /// (which happens while parsing the result of macro expansion)?
738723 pub fn is_whole_expr ( & self ) -> bool {
739724 #[ allow( irrefutable_let_patterns) ] // njn: temp
740725 if let Interpolated ( nt) = & self . kind
741- && let NtExpr ( _) | NtLiteral ( _) | NtPath ( _ ) | NtBlock ( _ ) = & * * nt
726+ && let NtExpr ( _) | NtLiteral ( _) = & * * nt
742727 {
743- return true ;
728+ true
729+ } else if matches ! ( self . is_metavar_seq( ) , Some ( NonterminalKind :: Path ) ) {
730+ true
731+ } else {
732+ false
744733 }
745-
746- false
747734 }
748735
749736 /// Is the token an interpolated block (`$b:block`)?
@@ -769,7 +756,7 @@ impl Token {
769756 pub fn is_path_start ( & self ) -> bool {
770757 self == & PathSep
771758 || self . is_qpath_start ( )
772- || self . is_whole_path ( )
759+ || matches ! ( self . is_metavar_seq ( ) , Some ( NonterminalKind :: Path ) )
773760 || self . is_path_segment_keyword ( )
774761 || self . is_ident ( ) && !self . is_reserved_ident ( )
775762 }
@@ -922,7 +909,6 @@ pub enum Nonterminal {
922909 NtBlock ( P < ast:: Block > ) ,
923910 NtExpr ( P < ast:: Expr > ) ,
924911 NtLiteral ( P < ast:: Expr > ) ,
925- NtPath ( P < ast:: Path > ) ,
926912}
927913
928914#[ derive( Debug , Copy , Clone , PartialEq , Eq , Encodable , Decodable , Hash , HashStable_Generic ) ]
@@ -1008,7 +994,6 @@ impl Nonterminal {
1008994 match self {
1009995 NtBlock ( block) => block. span ,
1010996 NtExpr ( expr) | NtLiteral ( expr) => expr. span ,
1011- NtPath ( path) => path. span ,
1012997 }
1013998 }
1014999
@@ -1017,7 +1002,6 @@ impl Nonterminal {
10171002 NtBlock ( ..) => "block" ,
10181003 NtExpr ( ..) => "expression" ,
10191004 NtLiteral ( ..) => "literal" ,
1020- NtPath ( ..) => "path" ,
10211005 }
10221006 }
10231007}
@@ -1038,7 +1022,6 @@ impl fmt::Debug for Nonterminal {
10381022 NtBlock ( ..) => f. pad ( "NtBlock(..)" ) ,
10391023 NtExpr ( ..) => f. pad ( "NtExpr(..)" ) ,
10401024 NtLiteral ( ..) => f. pad ( "NtLiteral(..)" ) ,
1041- NtPath ( ..) => f. pad ( "NtPath(..)" ) ,
10421025 }
10431026 }
10441027}
0 commit comments