@@ -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,19 @@ 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 if matches ! ( self . is_metavar_seq( ) , Some ( MetaVarKind :: Path ) ) {
858+ true
859+ } else {
860+ false
871861 }
872-
873- false
874862 }
875863
876864 /// Is the token an interpolated block (`$b:block`)?
@@ -896,7 +884,7 @@ impl Token {
896884 pub fn is_path_start ( & self ) -> bool {
897885 self == & PathSep
898886 || self . is_qpath_start ( )
899- || self . is_whole_path ( )
887+ || matches ! ( self . is_metavar_seq ( ) , Some ( MetaVarKind :: Path ) )
900888 || self . is_path_segment_keyword ( )
901889 || self . is_ident ( ) && !self . is_reserved_ident ( )
902890 }
@@ -1079,7 +1067,6 @@ pub enum Nonterminal {
10791067 NtStmt ( P < ast:: Stmt > ) ,
10801068 NtExpr ( P < ast:: Expr > ) ,
10811069 NtLiteral ( P < ast:: Expr > ) ,
1082- NtPath ( P < ast:: Path > ) ,
10831070}
10841071
10851072#[ derive( Debug , Copy , Clone , PartialEq , Eq , Encodable , Decodable , Hash , HashStable_Generic ) ]
@@ -1172,7 +1159,6 @@ impl Nonterminal {
11721159 NtBlock ( block) => block. span ,
11731160 NtStmt ( stmt) => stmt. span ,
11741161 NtExpr ( expr) | NtLiteral ( expr) => expr. span ,
1175- NtPath ( path) => path. span ,
11761162 }
11771163 }
11781164
@@ -1183,7 +1169,6 @@ impl Nonterminal {
11831169 NtStmt ( ..) => "statement" ,
11841170 NtExpr ( ..) => "expression" ,
11851171 NtLiteral ( ..) => "literal" ,
1186- NtPath ( ..) => "path" ,
11871172 }
11881173 }
11891174}
@@ -1206,7 +1191,6 @@ impl fmt::Debug for Nonterminal {
12061191 NtStmt ( ..) => f. pad ( "NtStmt(..)" ) ,
12071192 NtExpr ( ..) => f. pad ( "NtExpr(..)" ) ,
12081193 NtLiteral ( ..) => f. pad ( "NtLiteral(..)" ) ,
1209- NtPath ( ..) => f. pad ( "NtPath(..)" ) ,
12101194 }
12111195 }
12121196}
0 commit comments