@@ -624,8 +624,7 @@ impl Token {
624624 matches ! ( & * * nt,
625625 NtBlock ( ..) |
626626 NtExpr ( ..) |
627- NtLiteral ( ..) |
628- NtPath ( ..)
627+ NtLiteral ( ..)
629628 ) ,
630629 OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
631630 MetaVarKind :: Block |
@@ -661,7 +660,6 @@ impl Token {
661660 matches ! ( & * * nt,
662661 | NtExpr ( ..)
663662 | NtLiteral ( ..)
664- | NtPath ( ..)
665663 ) ,
666664 OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
667665 MetaVarKind :: Expr { .. } |
@@ -690,7 +688,6 @@ impl Token {
690688 Lifetime ( ..) | // lifetime bound in trait object
691689 Lt | BinOp ( Shl ) | // associated path
692690 PathSep => true , // global path
693- Interpolated ( ref nt) => matches ! ( & * * nt, NtPath ( ..) ) ,
694691 OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
695692 MetaVarKind :: Ty { .. } |
696693 MetaVarKind :: Path
@@ -849,27 +846,16 @@ impl Token {
849846 self . ident ( ) . is_some_and ( |( ident, _) | ident. name == name)
850847 }
851848
852- /// Returns `true` if the token is an interpolated path.
853- fn is_whole_path ( & self ) -> bool {
854- if let Interpolated ( nt) = & self . kind
855- && let NtPath ( ..) = & * * nt
856- {
857- return true ;
858- }
859-
860- false
861- }
862-
863849 /// Is this a pre-parsed expression dropped into the token stream
864850 /// (which happens while parsing the result of macro expansion)?
865851 pub fn is_whole_expr ( & self ) -> bool {
866852 if let Interpolated ( nt) = & self . kind
867- && let NtExpr ( _) | NtLiteral ( _) | NtPath ( _ ) | NtBlock ( _) = & * * nt
853+ && let NtExpr ( _) | NtLiteral ( _) | NtBlock ( _) = & * * nt
868854 {
869- return true ;
855+ true
856+ } else {
857+ matches ! ( self . is_metavar_seq( ) , Some ( MetaVarKind :: Path ) )
870858 }
871-
872- false
873859 }
874860
875861 /// Is the token an interpolated block (`$b:block`)?
@@ -895,7 +881,7 @@ impl Token {
895881 pub fn is_path_start ( & self ) -> bool {
896882 self == & PathSep
897883 || self . is_qpath_start ( )
898- || self . is_whole_path ( )
884+ || matches ! ( self . is_metavar_seq ( ) , Some ( MetaVarKind :: Path ) )
899885 || self . is_path_segment_keyword ( )
900886 || self . is_ident ( ) && !self . is_reserved_ident ( )
901887 }
@@ -1078,7 +1064,6 @@ pub enum Nonterminal {
10781064 NtStmt ( P < ast:: Stmt > ) ,
10791065 NtExpr ( P < ast:: Expr > ) ,
10801066 NtLiteral ( P < ast:: Expr > ) ,
1081- NtPath ( P < ast:: Path > ) ,
10821067}
10831068
10841069#[ derive( Debug , Copy , Clone , PartialEq , Eq , Encodable , Decodable , Hash , HashStable_Generic ) ]
@@ -1171,7 +1156,6 @@ impl Nonterminal {
11711156 NtBlock ( block) => block. span ,
11721157 NtStmt ( stmt) => stmt. span ,
11731158 NtExpr ( expr) | NtLiteral ( expr) => expr. span ,
1174- NtPath ( path) => path. span ,
11751159 }
11761160 }
11771161
@@ -1182,7 +1166,6 @@ impl Nonterminal {
11821166 NtStmt ( ..) => "statement" ,
11831167 NtExpr ( ..) => "expression" ,
11841168 NtLiteral ( ..) => "literal" ,
1185- NtPath ( ..) => "path" ,
11861169 }
11871170 }
11881171}
@@ -1205,7 +1188,6 @@ impl fmt::Debug for Nonterminal {
12051188 NtStmt ( ..) => f. pad ( "NtStmt(..)" ) ,
12061189 NtExpr ( ..) => f. pad ( "NtExpr(..)" ) ,
12071190 NtLiteral ( ..) => f. pad ( "NtLiteral(..)" ) ,
1208- NtPath ( ..) => f. pad ( "NtPath(..)" ) ,
12091191 }
12101192 }
12111193}
0 commit comments