@@ -614,8 +614,7 @@ impl Token {
614
614
matches ! ( & * * nt,
615
615
NtBlock ( ..) |
616
616
NtExpr ( ..) |
617
- NtLiteral ( ..) |
618
- NtPath ( ..)
617
+ NtLiteral ( ..)
619
618
) ,
620
619
OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
621
620
MetaVarKind :: Block |
@@ -651,7 +650,6 @@ impl Token {
651
650
matches ! ( & * * nt,
652
651
| NtExpr ( ..)
653
652
| NtLiteral ( ..)
654
- | NtPath ( ..)
655
653
) ,
656
654
OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
657
655
MetaVarKind :: Expr { .. } |
@@ -680,7 +678,6 @@ impl Token {
680
678
Lifetime ( ..) | // lifetime bound in trait object
681
679
Lt | BinOp ( Shl ) | // associated path
682
680
PathSep => true , // global path
683
- Interpolated ( ref nt) => matches ! ( & * * nt, NtPath ( ..) ) ,
684
681
OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
685
682
MetaVarKind :: Ty |
686
683
MetaVarKind :: Path
@@ -839,28 +836,19 @@ impl Token {
839
836
self . ident ( ) . is_some_and ( |( ident, _) | ident. name == name)
840
837
}
841
838
842
- /// Returns `true` if the token is an interpolated path.
843
- fn is_whole_path ( & self ) -> bool {
844
- if let Interpolated ( nt) = & self . kind
845
- && let NtPath ( ..) = & * * nt
846
- {
847
- return true ;
848
- }
849
-
850
- false
851
- }
852
-
853
839
/// Is this a pre-parsed expression dropped into the token stream
854
840
/// (which happens while parsing the result of macro expansion)?
855
841
pub fn is_whole_expr ( & self ) -> bool {
856
842
#[ allow( irrefutable_let_patterns) ] // FIXME: temporary
857
843
if let Interpolated ( nt) = & self . kind
858
- && let NtExpr ( _) | NtLiteral ( _) | NtPath ( _ ) | NtBlock ( _) = & * * nt
844
+ && let NtExpr ( _) | NtLiteral ( _) | NtBlock ( _) = & * * nt
859
845
{
860
- return true ;
846
+ true
847
+ } else if matches ! ( self . is_metavar_seq( ) , Some ( MetaVarKind :: Path ) ) {
848
+ true
849
+ } else {
850
+ false
861
851
}
862
-
863
- false
864
852
}
865
853
866
854
/// Is the token an interpolated block (`$b:block`)?
@@ -886,7 +874,7 @@ impl Token {
886
874
pub fn is_path_start ( & self ) -> bool {
887
875
self == & PathSep
888
876
|| self . is_qpath_start ( )
889
- || self . is_whole_path ( )
877
+ || matches ! ( self . is_metavar_seq ( ) , Some ( MetaVarKind :: Path ) )
890
878
|| self . is_path_segment_keyword ( )
891
879
|| self . is_ident ( ) && !self . is_reserved_ident ( )
892
880
}
@@ -1060,7 +1048,6 @@ pub enum Nonterminal {
1060
1048
NtBlock ( P < ast:: Block > ) ,
1061
1049
NtExpr ( P < ast:: Expr > ) ,
1062
1050
NtLiteral ( P < ast:: Expr > ) ,
1063
- NtPath ( P < ast:: Path > ) ,
1064
1051
}
1065
1052
1066
1053
#[ derive( Debug , Copy , Clone , PartialEq , Eq , Encodable , Decodable , Hash , HashStable_Generic ) ]
@@ -1151,7 +1138,6 @@ impl Nonterminal {
1151
1138
match self {
1152
1139
NtBlock ( block) => block. span ,
1153
1140
NtExpr ( expr) | NtLiteral ( expr) => expr. span ,
1154
- NtPath ( path) => path. span ,
1155
1141
}
1156
1142
}
1157
1143
@@ -1160,7 +1146,6 @@ impl Nonterminal {
1160
1146
NtBlock ( ..) => "block" ,
1161
1147
NtExpr ( ..) => "expression" ,
1162
1148
NtLiteral ( ..) => "literal" ,
1163
- NtPath ( ..) => "path" ,
1164
1149
}
1165
1150
}
1166
1151
}
@@ -1181,7 +1166,6 @@ impl fmt::Debug for Nonterminal {
1181
1166
NtBlock ( ..) => f. pad ( "NtBlock(..)" ) ,
1182
1167
NtExpr ( ..) => f. pad ( "NtExpr(..)" ) ,
1183
1168
NtLiteral ( ..) => f. pad ( "NtLiteral(..)" ) ,
1184
- NtPath ( ..) => f. pad ( "NtPath(..)" ) ,
1185
1169
}
1186
1170
}
1187
1171
}
0 commit comments