@@ -533,8 +533,7 @@ impl Token {
533533 Pound => true , // expression attributes
534534 Interpolated ( ref nt) => matches ! ( & * * nt, NtLiteral ( ..) |
535535 NtExpr ( ..) |
536- NtBlock ( ..) |
537- NtPath ( ..) ) ,
536+ NtBlock ( ..) ) ,
538537 OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
539538 NonterminalKind :: Block |
540539 NonterminalKind :: Expr |
@@ -562,9 +561,7 @@ impl Token {
562561 | DotDot | DotDotDot | DotDotEq // ranges
563562 | Lt | BinOp ( Shl ) // associated path
564563 | PathSep => true , // global path
565- Interpolated ( ref nt) => matches ! ( & * * nt, NtLiteral ( ..) |
566- NtBlock ( ..) |
567- NtPath ( ..) ) ,
564+ Interpolated ( ref nt) => matches ! ( & * * nt, NtLiteral ( ..) | NtBlock ( ..) ) ,
568565 OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
569566 NonterminalKind :: Block |
570567 NonterminalKind :: PatParam { .. } |
@@ -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
@@ -742,29 +738,20 @@ impl Token {
742738 self . ident ( ) . is_some_and ( |( ident, _) | ident. name == name)
743739 }
744740
745- /// Returns `true` if the token is an interpolated path.
746- fn is_whole_path ( & self ) -> bool {
747- if let Interpolated ( nt) = & self . kind
748- && let NtPath ( ..) = & * * nt
749- {
750- return true ;
751- }
752-
753- false
754- }
755-
756741 /// Would `maybe_whole_expr` in `parser.rs` return `Ok(..)`?
757742 /// That is, is this a pre-parsed expression dropped into the token stream
758743 /// (which happens while parsing the result of macro expansion)?
759744 pub fn is_whole_expr ( & self ) -> bool {
760745 #[ allow( irrefutable_let_patterns) ] // njn: temp
761746 if let Interpolated ( nt) = & self . kind
762- && let NtExpr ( _) | NtLiteral ( _) | NtPath ( _ ) | NtBlock ( _ ) = & * * nt
747+ && let NtExpr ( _) | NtLiteral ( _) = & * * nt
763748 {
764- return true ;
749+ true
750+ } else if matches ! ( self . is_metavar_seq( ) , Some ( NonterminalKind :: Path ) ) {
751+ true
752+ } else {
753+ false
765754 }
766-
767- false
768755 }
769756
770757 /// Is the token an interpolated block (`$b:block`)?
@@ -790,7 +777,7 @@ impl Token {
790777 pub fn is_path_start ( & self ) -> bool {
791778 self == & PathSep
792779 || self . is_qpath_start ( )
793- || self . is_whole_path ( )
780+ || matches ! ( self . is_metavar_seq ( ) , Some ( NonterminalKind :: Path ) )
794781 || self . is_path_segment_keyword ( )
795782 || self . is_ident ( ) && !self . is_reserved_ident ( )
796783 }
@@ -943,7 +930,6 @@ pub enum Nonterminal {
943930 NtBlock ( P < ast:: Block > ) ,
944931 NtExpr ( P < ast:: Expr > ) ,
945932 NtLiteral ( P < ast:: Expr > ) ,
946- NtPath ( P < ast:: Path > ) ,
947933}
948934
949935#[ derive( Debug , Copy , Clone , PartialEq , Eq , Encodable , Decodable , Hash , HashStable_Generic ) ]
@@ -1042,7 +1028,6 @@ impl Nonterminal {
10421028 match self {
10431029 NtBlock ( block) => block. span ,
10441030 NtExpr ( expr) | NtLiteral ( expr) => expr. span ,
1045- NtPath ( path) => path. span ,
10461031 }
10471032 }
10481033
@@ -1051,7 +1036,6 @@ impl Nonterminal {
10511036 NtBlock ( ..) => "block" ,
10521037 NtExpr ( ..) => "expression" ,
10531038 NtLiteral ( ..) => "literal" ,
1054- NtPath ( ..) => "path" ,
10551039 }
10561040 }
10571041}
@@ -1072,7 +1056,6 @@ impl fmt::Debug for Nonterminal {
10721056 NtBlock ( ..) => f. pad ( "NtBlock(..)" ) ,
10731057 NtExpr ( ..) => f. pad ( "NtExpr(..)" ) ,
10741058 NtLiteral ( ..) => f. pad ( "NtLiteral(..)" ) ,
1075- NtPath ( ..) => f. pad ( "NtPath(..)" ) ,
10761059 }
10771060 }
10781061}
0 commit comments