@@ -620,8 +620,7 @@ impl Token {
620620 matches ! ( & * * nt,
621621 NtBlock ( ..) |
622622 NtExpr ( ..) |
623- NtLiteral ( ..) |
624- NtPath ( ..)
623+ NtLiteral ( ..)
625624 ) ,
626625 OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
627626 MetaVarKind :: Block |
@@ -657,7 +656,6 @@ impl Token {
657656 matches ! ( & * * nt,
658657 | NtExpr ( ..)
659658 | NtLiteral ( ..)
660- | NtPath ( ..)
661659 ) ,
662660 OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
663661 MetaVarKind :: Expr { .. } |
@@ -686,7 +684,6 @@ impl Token {
686684 Lifetime ( ..) | // lifetime bound in trait object
687685 Lt | BinOp ( Shl ) | // associated path
688686 PathSep => true , // global path
689- Interpolated ( ref nt) => matches ! ( & * * nt, NtPath ( ..) ) ,
690687 OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
691688 MetaVarKind :: Ty |
692689 MetaVarKind :: Path
@@ -845,28 +842,19 @@ impl Token {
845842 self . ident ( ) . is_some_and ( |( ident, _) | ident. name == name)
846843 }
847844
848- /// Returns `true` if the token is an interpolated path.
849- fn is_whole_path ( & self ) -> bool {
850- if let Interpolated ( nt) = & self . kind
851- && let NtPath ( ..) = & * * nt
852- {
853- return true ;
854- }
855-
856- false
857- }
858-
859845 /// Is this a pre-parsed expression dropped into the token stream
860846 /// (which happens while parsing the result of macro expansion)?
861847 pub fn is_whole_expr ( & self ) -> bool {
862848 #[ allow( irrefutable_let_patterns) ] // FIXME: temporary
863849 if let Interpolated ( nt) = & self . kind
864- && let NtExpr ( _) | NtLiteral ( _) | NtPath ( _ ) | NtBlock ( _) = & * * nt
850+ && let NtExpr ( _) | NtLiteral ( _) | NtBlock ( _) = & * * nt
865851 {
866- return true ;
852+ true
853+ } else if matches ! ( self . is_metavar_seq( ) , Some ( MetaVarKind :: Path ) ) {
854+ true
855+ } else {
856+ false
867857 }
868-
869- false
870858 }
871859
872860 /// Is the token an interpolated block (`$b:block`)?
@@ -892,7 +880,7 @@ impl Token {
892880 pub fn is_path_start ( & self ) -> bool {
893881 self == & PathSep
894882 || self . is_qpath_start ( )
895- || self . is_whole_path ( )
883+ || matches ! ( self . is_metavar_seq ( ) , Some ( MetaVarKind :: Path ) )
896884 || self . is_path_segment_keyword ( )
897885 || self . is_ident ( ) && !self . is_reserved_ident ( )
898886 }
@@ -1066,7 +1054,6 @@ pub enum Nonterminal {
10661054 NtBlock ( P < ast:: Block > ) ,
10671055 NtExpr ( P < ast:: Expr > ) ,
10681056 NtLiteral ( P < ast:: Expr > ) ,
1069- NtPath ( P < ast:: Path > ) ,
10701057}
10711058
10721059#[ derive( Debug , Copy , Clone , PartialEq , Eq , Encodable , Decodable , Hash , HashStable_Generic ) ]
@@ -1157,7 +1144,6 @@ impl Nonterminal {
11571144 match self {
11581145 NtBlock ( block) => block. span ,
11591146 NtExpr ( expr) | NtLiteral ( expr) => expr. span ,
1160- NtPath ( path) => path. span ,
11611147 }
11621148 }
11631149
@@ -1166,7 +1152,6 @@ impl Nonterminal {
11661152 NtBlock ( ..) => "block" ,
11671153 NtExpr ( ..) => "expression" ,
11681154 NtLiteral ( ..) => "literal" ,
1169- NtPath ( ..) => "path" ,
11701155 }
11711156 }
11721157}
@@ -1187,7 +1172,6 @@ impl fmt::Debug for Nonterminal {
11871172 NtBlock ( ..) => f. pad ( "NtBlock(..)" ) ,
11881173 NtExpr ( ..) => f. pad ( "NtExpr(..)" ) ,
11891174 NtLiteral ( ..) => f. pad ( "NtLiteral(..)" ) ,
1190- NtPath ( ..) => f. pad ( "NtPath(..)" ) ,
11911175 }
11921176 }
11931177}
0 commit comments