@@ -624,8 +624,7 @@ impl Token {
624
624
matches ! ( & * * nt,
625
625
NtBlock ( ..) |
626
626
NtExpr ( ..) |
627
- NtLiteral ( ..) |
628
- NtPath ( ..)
627
+ NtLiteral ( ..)
629
628
) ,
630
629
OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
631
630
MetaVarKind :: Block |
@@ -661,7 +660,6 @@ impl Token {
661
660
matches ! ( & * * nt,
662
661
| NtExpr ( ..)
663
662
| NtLiteral ( ..)
664
- | NtPath ( ..)
665
663
) ,
666
664
OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
667
665
MetaVarKind :: Expr { .. } |
@@ -690,7 +688,6 @@ impl Token {
690
688
Lifetime ( ..) | // lifetime bound in trait object
691
689
Lt | BinOp ( Shl ) | // associated path
692
690
PathSep => true , // global path
693
- Interpolated ( ref nt) => matches ! ( & * * nt, NtPath ( ..) ) ,
694
691
OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
695
692
MetaVarKind :: Ty { .. } |
696
693
MetaVarKind :: Path
@@ -849,27 +846,16 @@ impl Token {
849
846
self . ident ( ) . is_some_and ( |( ident, _) | ident. name == name)
850
847
}
851
848
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
-
863
849
/// Is this a pre-parsed expression dropped into the token stream
864
850
/// (which happens while parsing the result of macro expansion)?
865
851
pub fn is_whole_expr ( & self ) -> bool {
866
852
if let Interpolated ( nt) = & self . kind
867
- && let NtExpr ( _) | NtLiteral ( _) | NtPath ( _ ) | NtBlock ( _) = & * * nt
853
+ && let NtExpr ( _) | NtLiteral ( _) | NtBlock ( _) = & * * nt
868
854
{
869
- return true ;
855
+ true
856
+ } else {
857
+ matches ! ( self . is_metavar_seq( ) , Some ( MetaVarKind :: Path ) )
870
858
}
871
-
872
- false
873
859
}
874
860
875
861
/// Is the token an interpolated block (`$b:block`)?
@@ -895,7 +881,7 @@ impl Token {
895
881
pub fn is_path_start ( & self ) -> bool {
896
882
self == & PathSep
897
883
|| self . is_qpath_start ( )
898
- || self . is_whole_path ( )
884
+ || matches ! ( self . is_metavar_seq ( ) , Some ( MetaVarKind :: Path ) )
899
885
|| self . is_path_segment_keyword ( )
900
886
|| self . is_ident ( ) && !self . is_reserved_ident ( )
901
887
}
@@ -1078,7 +1064,6 @@ pub enum Nonterminal {
1078
1064
NtStmt ( P < ast:: Stmt > ) ,
1079
1065
NtExpr ( P < ast:: Expr > ) ,
1080
1066
NtLiteral ( P < ast:: Expr > ) ,
1081
- NtPath ( P < ast:: Path > ) ,
1082
1067
}
1083
1068
1084
1069
#[ derive( Debug , Copy , Clone , PartialEq , Eq , Encodable , Decodable , Hash , HashStable_Generic ) ]
@@ -1171,7 +1156,6 @@ impl Nonterminal {
1171
1156
NtBlock ( block) => block. span ,
1172
1157
NtStmt ( stmt) => stmt. span ,
1173
1158
NtExpr ( expr) | NtLiteral ( expr) => expr. span ,
1174
- NtPath ( path) => path. span ,
1175
1159
}
1176
1160
}
1177
1161
@@ -1182,7 +1166,6 @@ impl Nonterminal {
1182
1166
NtStmt ( ..) => "statement" ,
1183
1167
NtExpr ( ..) => "expression" ,
1184
1168
NtLiteral ( ..) => "literal" ,
1185
- NtPath ( ..) => "path" ,
1186
1169
}
1187
1170
}
1188
1171
}
@@ -1205,7 +1188,6 @@ impl fmt::Debug for Nonterminal {
1205
1188
NtStmt ( ..) => f. pad ( "NtStmt(..)" ) ,
1206
1189
NtExpr ( ..) => f. pad ( "NtExpr(..)" ) ,
1207
1190
NtLiteral ( ..) => f. pad ( "NtLiteral(..)" ) ,
1208
- NtPath ( ..) => f. pad ( "NtPath(..)" ) ,
1209
1191
}
1210
1192
}
1211
1193
}
0 commit comments