@@ -621,8 +621,7 @@ impl Token {
621621 matches ! ( & * * nt,
622622 NtBlock ( ..) |
623623 NtExpr ( ..) |
624- NtLiteral ( ..) |
625- NtPath ( ..)
624+ NtLiteral ( ..)
626625 ) ,
627626 OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
628627 MetaVarKind :: Block |
@@ -658,7 +657,6 @@ impl Token {
658657 matches ! ( & * * nt,
659658 | NtExpr ( ..)
660659 | NtLiteral ( ..)
661- | NtPath ( ..)
662660 ) ,
663661 OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
664662 MetaVarKind :: Expr { .. } |
@@ -687,7 +685,6 @@ impl Token {
687685 Lifetime ( ..) | // lifetime bound in trait object
688686 Lt | BinOp ( Shl ) | // associated path
689687 PathSep => true , // global path
690- Interpolated ( ref nt) => matches ! ( & * * nt, NtPath ( ..) ) ,
691688 OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
692689 MetaVarKind :: Ty { .. } |
693690 MetaVarKind :: Path
@@ -846,28 +843,19 @@ impl Token {
846843 self . ident ( ) . is_some_and ( |( ident, _) | ident. name == name)
847844 }
848845
849- /// Returns `true` if the token is an interpolated path.
850- fn is_whole_path ( & self ) -> bool {
851- if let Interpolated ( nt) = & self . kind
852- && let NtPath ( ..) = & * * nt
853- {
854- return true ;
855- }
856-
857- false
858- }
859-
860846 /// Is this a pre-parsed expression dropped into the token stream
861847 /// (which happens while parsing the result of macro expansion)?
862848 pub fn is_whole_expr ( & self ) -> bool {
863849 #[ allow( irrefutable_let_patterns) ] // FIXME: temporary
864850 if let Interpolated ( nt) = & self . kind
865- && let NtExpr ( _) | NtLiteral ( _) | NtPath ( _ ) | NtBlock ( _) = & * * nt
851+ && let NtExpr ( _) | NtLiteral ( _) | NtBlock ( _) = & * * nt
866852 {
867- return true ;
853+ true
854+ } else if matches ! ( self . is_metavar_seq( ) , Some ( MetaVarKind :: Path ) ) {
855+ true
856+ } else {
857+ false
868858 }
869-
870- false
871859 }
872860
873861 /// Is the token an interpolated block (`$b:block`)?
@@ -893,7 +881,7 @@ impl Token {
893881 pub fn is_path_start ( & self ) -> bool {
894882 self == & PathSep
895883 || self . is_qpath_start ( )
896- || self . is_whole_path ( )
884+ || matches ! ( self . is_metavar_seq ( ) , Some ( MetaVarKind :: Path ) )
897885 || self . is_path_segment_keyword ( )
898886 || self . is_ident ( ) && !self . is_reserved_ident ( )
899887 }
@@ -1074,7 +1062,6 @@ pub enum Nonterminal {
10741062 NtBlock ( P < ast:: Block > ) ,
10751063 NtExpr ( P < ast:: Expr > ) ,
10761064 NtLiteral ( P < ast:: Expr > ) ,
1077- NtPath ( P < ast:: Path > ) ,
10781065}
10791066
10801067#[ derive( Debug , Copy , Clone , PartialEq , Eq , Encodable , Decodable , Hash , HashStable_Generic ) ]
@@ -1165,7 +1152,6 @@ impl Nonterminal {
11651152 match self {
11661153 NtBlock ( block) => block. span ,
11671154 NtExpr ( expr) | NtLiteral ( expr) => expr. span ,
1168- NtPath ( path) => path. span ,
11691155 }
11701156 }
11711157
@@ -1174,7 +1160,6 @@ impl Nonterminal {
11741160 NtBlock ( ..) => "block" ,
11751161 NtExpr ( ..) => "expression" ,
11761162 NtLiteral ( ..) => "literal" ,
1177- NtPath ( ..) => "path" ,
11781163 }
11791164 }
11801165}
@@ -1195,7 +1180,6 @@ impl fmt::Debug for Nonterminal {
11951180 NtBlock ( ..) => f. pad ( "NtBlock(..)" ) ,
11961181 NtExpr ( ..) => f. pad ( "NtExpr(..)" ) ,
11971182 NtLiteral ( ..) => f. pad ( "NtLiteral(..)" ) ,
1198- NtPath ( ..) => f. pad ( "NtPath(..)" ) ,
11991183 }
12001184 }
12011185}
0 commit comments