@@ -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,28 +846,17 @@ 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 #[ allow( irrefutable_let_patterns) ] // FIXME: temporary
867853 if let Interpolated ( nt) = & self . kind
868- && let NtExpr ( _) | NtLiteral ( _) | NtPath ( _ ) | NtBlock ( _) = & * * nt
854+ && let NtExpr ( _) | NtLiteral ( _) | NtBlock ( _) = & * * nt
869855 {
870- return true ;
856+ true
857+ } else {
858+ matches ! ( self . is_metavar_seq( ) , Some ( MetaVarKind :: Path ) )
871859 }
872-
873- false
874860 }
875861
876862 /// Is the token an interpolated block (`$b:block`)?
@@ -896,7 +882,7 @@ impl Token {
896882 pub fn is_path_start ( & self ) -> bool {
897883 self == & PathSep
898884 || self . is_qpath_start ( )
899- || self . is_whole_path ( )
885+ || matches ! ( self . is_metavar_seq ( ) , Some ( MetaVarKind :: Path ) )
900886 || self . is_path_segment_keyword ( )
901887 || self . is_ident ( ) && !self . is_reserved_ident ( )
902888 }
@@ -1079,7 +1065,6 @@ pub enum Nonterminal {
10791065 NtStmt ( P < ast:: Stmt > ) ,
10801066 NtExpr ( P < ast:: Expr > ) ,
10811067 NtLiteral ( P < ast:: Expr > ) ,
1082- NtPath ( P < ast:: Path > ) ,
10831068}
10841069
10851070#[ derive( Debug , Copy , Clone , PartialEq , Eq , Encodable , Decodable , Hash , HashStable_Generic ) ]
@@ -1172,7 +1157,6 @@ impl Nonterminal {
11721157 NtBlock ( block) => block. span ,
11731158 NtStmt ( stmt) => stmt. span ,
11741159 NtExpr ( expr) | NtLiteral ( expr) => expr. span ,
1175- NtPath ( path) => path. span ,
11761160 }
11771161 }
11781162
@@ -1183,7 +1167,6 @@ impl Nonterminal {
11831167 NtStmt ( ..) => "statement" ,
11841168 NtExpr ( ..) => "expression" ,
11851169 NtLiteral ( ..) => "literal" ,
1186- NtPath ( ..) => "path" ,
11871170 }
11881171 }
11891172}
@@ -1206,7 +1189,6 @@ impl fmt::Debug for Nonterminal {
12061189 NtStmt ( ..) => f. pad ( "NtStmt(..)" ) ,
12071190 NtExpr ( ..) => f. pad ( "NtExpr(..)" ) ,
12081191 NtLiteral ( ..) => f. pad ( "NtLiteral(..)" ) ,
1209- NtPath ( ..) => f. pad ( "NtPath(..)" ) ,
12101192 }
12111193 }
12121194}
0 commit comments