@@ -614,8 +614,7 @@ impl Token {
614614 matches ! ( & * * nt,
615615 NtBlock ( ..) |
616616 NtExpr ( ..) |
617- NtLiteral ( ..) |
618- NtPath ( ..)
617+ NtLiteral ( ..)
619618 ) ,
620619 OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
621620 MetaVarKind :: Block |
@@ -651,7 +650,6 @@ impl Token {
651650 matches ! ( & * * nt,
652651 | NtExpr ( ..)
653652 | NtLiteral ( ..)
654- | NtPath ( ..)
655653 ) ,
656654 OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
657655 MetaVarKind :: Expr { .. } |
@@ -680,7 +678,6 @@ impl Token {
680678 Lifetime ( ..) | // lifetime bound in trait object
681679 Lt | BinOp ( Shl ) | // associated path
682680 PathSep => true , // global path
683- Interpolated ( ref nt) => matches ! ( & * * nt, NtPath ( ..) ) ,
684681 OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
685682 MetaVarKind :: Ty |
686683 MetaVarKind :: Path
@@ -839,28 +836,19 @@ impl Token {
839836 self . ident ( ) . is_some_and ( |( ident, _) | ident. name == name)
840837 }
841838
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-
853839 /// Is this a pre-parsed expression dropped into the token stream
854840 /// (which happens while parsing the result of macro expansion)?
855841 pub fn is_whole_expr ( & self ) -> bool {
856842 #[ allow( irrefutable_let_patterns) ] // FIXME: temporary
857843 if let Interpolated ( nt) = & self . kind
858- && let NtExpr ( _) | NtLiteral ( _) | NtPath ( _ ) | NtBlock ( _) = & * * nt
844+ && let NtExpr ( _) | NtLiteral ( _) | NtBlock ( _) = & * * nt
859845 {
860- return true ;
846+ true
847+ } else if matches ! ( self . is_metavar_seq( ) , Some ( MetaVarKind :: Path ) ) {
848+ true
849+ } else {
850+ false
861851 }
862-
863- false
864852 }
865853
866854 /// Is the token an interpolated block (`$b:block`)?
@@ -886,7 +874,7 @@ impl Token {
886874 pub fn is_path_start ( & self ) -> bool {
887875 self == & PathSep
888876 || self . is_qpath_start ( )
889- || self . is_whole_path ( )
877+ || matches ! ( self . is_metavar_seq ( ) , Some ( MetaVarKind :: Path ) )
890878 || self . is_path_segment_keyword ( )
891879 || self . is_ident ( ) && !self . is_reserved_ident ( )
892880 }
@@ -1060,7 +1048,6 @@ pub enum Nonterminal {
10601048 NtBlock ( P < ast:: Block > ) ,
10611049 NtExpr ( P < ast:: Expr > ) ,
10621050 NtLiteral ( P < ast:: Expr > ) ,
1063- NtPath ( P < ast:: Path > ) ,
10641051}
10651052
10661053#[ derive( Debug , Copy , Clone , PartialEq , Eq , Encodable , Decodable , Hash , HashStable_Generic ) ]
@@ -1151,7 +1138,6 @@ impl Nonterminal {
11511138 match self {
11521139 NtBlock ( block) => block. span ,
11531140 NtExpr ( expr) | NtLiteral ( expr) => expr. span ,
1154- NtPath ( path) => path. span ,
11551141 }
11561142 }
11571143
@@ -1160,7 +1146,6 @@ impl Nonterminal {
11601146 NtBlock ( ..) => "block" ,
11611147 NtExpr ( ..) => "expression" ,
11621148 NtLiteral ( ..) => "literal" ,
1163- NtPath ( ..) => "path" ,
11641149 }
11651150 }
11661151}
@@ -1181,7 +1166,6 @@ impl fmt::Debug for Nonterminal {
11811166 NtBlock ( ..) => f. pad ( "NtBlock(..)" ) ,
11821167 NtExpr ( ..) => f. pad ( "NtExpr(..)" ) ,
11831168 NtLiteral ( ..) => f. pad ( "NtLiteral(..)" ) ,
1184- NtPath ( ..) => f. pad ( "NtPath(..)" ) ,
11851169 }
11861170 }
11871171}
0 commit comments