@@ -620,8 +620,7 @@ impl Token {
620
620
matches ! ( & * * nt,
621
621
NtBlock ( ..) |
622
622
NtExpr ( ..) |
623
- NtLiteral ( ..) |
624
- NtPath ( ..)
623
+ NtLiteral ( ..)
625
624
) ,
626
625
OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
627
626
MetaVarKind :: Block |
@@ -657,7 +656,6 @@ impl Token {
657
656
matches ! ( & * * nt,
658
657
| NtExpr ( ..)
659
658
| NtLiteral ( ..)
660
- | NtPath ( ..)
661
659
) ,
662
660
OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
663
661
MetaVarKind :: Expr { .. } |
@@ -686,7 +684,6 @@ impl Token {
686
684
Lifetime ( ..) | // lifetime bound in trait object
687
685
Lt | BinOp ( Shl ) | // associated path
688
686
PathSep => true , // global path
689
- Interpolated ( ref nt) => matches ! ( & * * nt, NtPath ( ..) ) ,
690
687
OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
691
688
MetaVarKind :: Ty |
692
689
MetaVarKind :: Path
@@ -845,28 +842,19 @@ impl Token {
845
842
self . ident ( ) . is_some_and ( |( ident, _) | ident. name == name)
846
843
}
847
844
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
-
859
845
/// Is this a pre-parsed expression dropped into the token stream
860
846
/// (which happens while parsing the result of macro expansion)?
861
847
pub fn is_whole_expr ( & self ) -> bool {
862
848
#[ allow( irrefutable_let_patterns) ] // FIXME: temporary
863
849
if let Interpolated ( nt) = & self . kind
864
- && let NtExpr ( _) | NtLiteral ( _) | NtPath ( _ ) | NtBlock ( _) = & * * nt
850
+ && let NtExpr ( _) | NtLiteral ( _) | NtBlock ( _) = & * * nt
865
851
{
866
- return true ;
852
+ true
853
+ } else if matches ! ( self . is_metavar_seq( ) , Some ( MetaVarKind :: Path ) ) {
854
+ true
855
+ } else {
856
+ false
867
857
}
868
-
869
- false
870
858
}
871
859
872
860
/// Is the token an interpolated block (`$b:block`)?
@@ -892,7 +880,7 @@ impl Token {
892
880
pub fn is_path_start ( & self ) -> bool {
893
881
self == & PathSep
894
882
|| self . is_qpath_start ( )
895
- || self . is_whole_path ( )
883
+ || matches ! ( self . is_metavar_seq ( ) , Some ( MetaVarKind :: Path ) )
896
884
|| self . is_path_segment_keyword ( )
897
885
|| self . is_ident ( ) && !self . is_reserved_ident ( )
898
886
}
@@ -1066,7 +1054,6 @@ pub enum Nonterminal {
1066
1054
NtBlock ( P < ast:: Block > ) ,
1067
1055
NtExpr ( P < ast:: Expr > ) ,
1068
1056
NtLiteral ( P < ast:: Expr > ) ,
1069
- NtPath ( P < ast:: Path > ) ,
1070
1057
}
1071
1058
1072
1059
#[ derive( Debug , Copy , Clone , PartialEq , Eq , Encodable , Decodable , Hash , HashStable_Generic ) ]
@@ -1157,7 +1144,6 @@ impl Nonterminal {
1157
1144
match self {
1158
1145
NtBlock ( block) => block. span ,
1159
1146
NtExpr ( expr) | NtLiteral ( expr) => expr. span ,
1160
- NtPath ( path) => path. span ,
1161
1147
}
1162
1148
}
1163
1149
@@ -1166,7 +1152,6 @@ impl Nonterminal {
1166
1152
NtBlock ( ..) => "block" ,
1167
1153
NtExpr ( ..) => "expression" ,
1168
1154
NtLiteral ( ..) => "literal" ,
1169
- NtPath ( ..) => "path" ,
1170
1155
}
1171
1156
}
1172
1157
}
@@ -1187,7 +1172,6 @@ impl fmt::Debug for Nonterminal {
1187
1172
NtBlock ( ..) => f. pad ( "NtBlock(..)" ) ,
1188
1173
NtExpr ( ..) => f. pad ( "NtExpr(..)" ) ,
1189
1174
NtLiteral ( ..) => f. pad ( "NtLiteral(..)" ) ,
1190
- NtPath ( ..) => f. pad ( "NtPath(..)" ) ,
1191
1175
}
1192
1176
}
1193
1177
}
0 commit comments