@@ -535,8 +535,7 @@ impl Token {
535
535
Pound => true , // expression attributes
536
536
Interpolated ( ref nt) => matches ! ( & * * nt, NtLiteral ( ..) |
537
537
NtExpr ( ..) |
538
- NtBlock ( ..) |
539
- NtPath ( ..) ) ,
538
+ NtBlock ( ..) ) ,
540
539
OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
541
540
NonterminalKind :: Block |
542
541
NonterminalKind :: Expr ( _) |
@@ -563,9 +562,7 @@ impl Token {
563
562
| DotDot | DotDotDot | DotDotEq // ranges
564
563
| Lt | BinOp ( Shl ) // associated path
565
564
| PathSep => true , // global path
566
- Interpolated ( ref nt) => matches ! ( & * * nt, NtLiteral ( ..) |
567
- NtBlock ( ..) |
568
- NtPath ( ..) ) ,
565
+ Interpolated ( ref nt) => matches ! ( & * * nt, NtLiteral ( ..) | NtBlock ( ..) ) ,
569
566
OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
570
567
NonterminalKind :: Block |
571
568
NonterminalKind :: Pat ( _) |
@@ -591,7 +588,6 @@ impl Token {
591
588
Lifetime ( ..) | // lifetime bound in trait object
592
589
Lt | BinOp ( Shl ) | // associated path
593
590
PathSep => true , // global path
594
- Interpolated ( ref nt) => matches ! ( & * * nt, NtPath ( ..) ) ,
595
591
OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
596
592
NonterminalKind :: Ty |
597
593
NonterminalKind :: Path
@@ -740,29 +736,20 @@ impl Token {
740
736
self . ident ( ) . is_some_and ( |( ident, _) | ident. name == name)
741
737
}
742
738
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
-
754
739
/// Would `maybe_whole_expr` in `parser.rs` return `Ok(..)`?
755
740
/// That is, is this a pre-parsed expression dropped into the token stream
756
741
/// (which happens while parsing the result of macro expansion)?
757
742
pub fn is_whole_expr ( & self ) -> bool {
758
743
#[ allow( irrefutable_let_patterns) ] // njn: temp
759
744
if let Interpolated ( nt) = & self . kind
760
- && let NtExpr ( _) | NtLiteral ( _) | NtPath ( _ ) | NtBlock ( _ ) = & * * nt
745
+ && let NtExpr ( _) | NtLiteral ( _) = & * * nt
761
746
{
762
- return true ;
747
+ true
748
+ } else if matches ! ( self . is_metavar_seq( ) , Some ( NonterminalKind :: Path ) ) {
749
+ true
750
+ } else {
751
+ false
763
752
}
764
-
765
- false
766
753
}
767
754
768
755
/// Is the token an interpolated block (`$b:block`)?
@@ -788,7 +775,7 @@ impl Token {
788
775
pub fn is_path_start ( & self ) -> bool {
789
776
self == & PathSep
790
777
|| self . is_qpath_start ( )
791
- || self . is_whole_path ( )
778
+ || matches ! ( self . is_metavar_seq ( ) , Some ( NonterminalKind :: Path ) )
792
779
|| self . is_path_segment_keyword ( )
793
780
|| self . is_ident ( ) && !self . is_reserved_ident ( )
794
781
}
@@ -962,7 +949,6 @@ pub enum Nonterminal {
962
949
NtBlock ( P < ast:: Block > ) ,
963
950
NtExpr ( P < ast:: Expr > ) ,
964
951
NtLiteral ( P < ast:: Expr > ) ,
965
- NtPath ( P < ast:: Path > ) ,
966
952
}
967
953
968
954
#[ derive( Debug , Copy , Clone , PartialEq , Eq , Encodable , Decodable , Hash , HashStable_Generic ) ]
@@ -1053,7 +1039,6 @@ impl Nonterminal {
1053
1039
match self {
1054
1040
NtBlock ( block) => block. span ,
1055
1041
NtExpr ( expr) | NtLiteral ( expr) => expr. span ,
1056
- NtPath ( path) => path. span ,
1057
1042
}
1058
1043
}
1059
1044
@@ -1062,7 +1047,6 @@ impl Nonterminal {
1062
1047
NtBlock ( ..) => "block" ,
1063
1048
NtExpr ( ..) => "expression" ,
1064
1049
NtLiteral ( ..) => "literal" ,
1065
- NtPath ( ..) => "path" ,
1066
1050
}
1067
1051
}
1068
1052
}
@@ -1083,7 +1067,6 @@ impl fmt::Debug for Nonterminal {
1083
1067
NtBlock ( ..) => f. pad ( "NtBlock(..)" ) ,
1084
1068
NtExpr ( ..) => f. pad ( "NtExpr(..)" ) ,
1085
1069
NtLiteral ( ..) => f. pad ( "NtLiteral(..)" ) ,
1086
- NtPath ( ..) => f. pad ( "NtPath(..)" ) ,
1087
1070
}
1088
1071
}
1089
1072
}
0 commit comments