@@ -535,8 +535,7 @@ impl Token {
535535 Pound => true , // expression attributes
536536 Interpolated ( ref nt) => matches ! ( & * * nt, NtLiteral ( ..) |
537537 NtExpr ( ..) |
538- NtBlock ( ..) |
539- NtPath ( ..) ) ,
538+ NtBlock ( ..) ) ,
540539 OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
541540 NonterminalKind :: Block |
542541 NonterminalKind :: Expr ( _) |
@@ -563,9 +562,7 @@ impl Token {
563562 | DotDot | DotDotDot | DotDotEq // ranges
564563 | Lt | BinOp ( Shl ) // associated path
565564 | PathSep => true , // global path
566- Interpolated ( ref nt) => matches ! ( & * * nt, NtLiteral ( ..) |
567- NtBlock ( ..) |
568- NtPath ( ..) ) ,
565+ Interpolated ( ref nt) => matches ! ( & * * nt, NtLiteral ( ..) | NtBlock ( ..) ) ,
569566 OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
570567 NonterminalKind :: Block |
571568 NonterminalKind :: Pat ( _) |
@@ -591,7 +588,6 @@ impl Token {
591588 Lifetime ( ..) | // lifetime bound in trait object
592589 Lt | BinOp ( Shl ) | // associated path
593590 PathSep => true , // global path
594- Interpolated ( ref nt) => matches ! ( & * * nt, NtPath ( ..) ) ,
595591 OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
596592 NonterminalKind :: Ty |
597593 NonterminalKind :: Path
@@ -740,29 +736,20 @@ impl Token {
740736 self . ident ( ) . is_some_and ( |( ident, _) | ident. name == name)
741737 }
742738
743- /// Returns `true` if the token is an interpolated path.
744- fn is_whole_path ( & self ) -> bool {
745- if let Interpolated ( nt) = & self . kind
746- && let NtPath ( ..) = & * * nt
747- {
748- return true ;
749- }
750-
751- false
752- }
753-
754739 /// Would `maybe_whole_expr` in `parser.rs` return `Ok(..)`?
755740 /// That is, is this a pre-parsed expression dropped into the token stream
756741 /// (which happens while parsing the result of macro expansion)?
757742 pub fn is_whole_expr ( & self ) -> bool {
758743 #[ allow( irrefutable_let_patterns) ] // njn: temp
759744 if let Interpolated ( nt) = & self . kind
760- && let NtExpr ( _) | NtLiteral ( _) | NtPath ( _ ) | NtBlock ( _ ) = & * * nt
745+ && let NtExpr ( _) | NtLiteral ( _) = & * * nt
761746 {
762- return true ;
747+ true
748+ } else if matches ! ( self . is_metavar_seq( ) , Some ( NonterminalKind :: Path ) ) {
749+ true
750+ } else {
751+ false
763752 }
764-
765- false
766753 }
767754
768755 /// Is the token an interpolated block (`$b:block`)?
@@ -788,7 +775,7 @@ impl Token {
788775 pub fn is_path_start ( & self ) -> bool {
789776 self == & PathSep
790777 || self . is_qpath_start ( )
791- || self . is_whole_path ( )
778+ || matches ! ( self . is_metavar_seq ( ) , Some ( NonterminalKind :: Path ) )
792779 || self . is_path_segment_keyword ( )
793780 || self . is_ident ( ) && !self . is_reserved_ident ( )
794781 }
@@ -962,7 +949,6 @@ pub enum Nonterminal {
962949 NtBlock ( P < ast:: Block > ) ,
963950 NtExpr ( P < ast:: Expr > ) ,
964951 NtLiteral ( P < ast:: Expr > ) ,
965- NtPath ( P < ast:: Path > ) ,
966952}
967953
968954#[ derive( Debug , Copy , Clone , PartialEq , Eq , Encodable , Decodable , Hash , HashStable_Generic ) ]
@@ -1053,7 +1039,6 @@ impl Nonterminal {
10531039 match self {
10541040 NtBlock ( block) => block. span ,
10551041 NtExpr ( expr) | NtLiteral ( expr) => expr. span ,
1056- NtPath ( path) => path. span ,
10571042 }
10581043 }
10591044
@@ -1062,7 +1047,6 @@ impl Nonterminal {
10621047 NtBlock ( ..) => "block" ,
10631048 NtExpr ( ..) => "expression" ,
10641049 NtLiteral ( ..) => "literal" ,
1065- NtPath ( ..) => "path" ,
10661050 }
10671051 }
10681052}
@@ -1083,7 +1067,6 @@ impl fmt::Debug for Nonterminal {
10831067 NtBlock ( ..) => f. pad ( "NtBlock(..)" ) ,
10841068 NtExpr ( ..) => f. pad ( "NtExpr(..)" ) ,
10851069 NtLiteral ( ..) => f. pad ( "NtLiteral(..)" ) ,
1086- NtPath ( ..) => f. pad ( "NtPath(..)" ) ,
10871070 }
10881071 }
10891072}
0 commit comments