@@ -533,8 +533,7 @@ impl Token {
533
533
Pound => true , // expression attributes
534
534
Interpolated ( ref nt) => matches ! ( & * * nt, NtLiteral ( ..) |
535
535
NtExpr ( ..) |
536
- NtBlock ( ..) |
537
- NtPath ( ..) ) ,
536
+ NtBlock ( ..) ) ,
538
537
OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
539
538
NonterminalKind :: Block |
540
539
NonterminalKind :: Expr |
@@ -562,9 +561,7 @@ impl Token {
562
561
| DotDot | DotDotDot | DotDotEq // ranges
563
562
| Lt | BinOp ( Shl ) // associated path
564
563
| PathSep => true , // global path
565
- Interpolated ( ref nt) => matches ! ( & * * nt, NtLiteral ( ..) |
566
- NtBlock ( ..) |
567
- NtPath ( ..) ) ,
564
+ Interpolated ( ref nt) => matches ! ( & * * nt, NtLiteral ( ..) | NtBlock ( ..) ) ,
568
565
OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
569
566
NonterminalKind :: Block |
570
567
NonterminalKind :: PatParam { .. } |
@@ -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
@@ -742,29 +738,20 @@ impl Token {
742
738
self . ident ( ) . is_some_and ( |( ident, _) | ident. name == name)
743
739
}
744
740
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
-
756
741
/// Would `maybe_whole_expr` in `parser.rs` return `Ok(..)`?
757
742
/// That is, is this a pre-parsed expression dropped into the token stream
758
743
/// (which happens while parsing the result of macro expansion)?
759
744
pub fn is_whole_expr ( & self ) -> bool {
760
745
#[ allow( irrefutable_let_patterns) ] // njn: temp
761
746
if let Interpolated ( nt) = & self . kind
762
- && let NtExpr ( _) | NtLiteral ( _) | NtPath ( _ ) | NtBlock ( _ ) = & * * nt
747
+ && let NtExpr ( _) | NtLiteral ( _) = & * * nt
763
748
{
764
- return true ;
749
+ true
750
+ } else if matches ! ( self . is_metavar_seq( ) , Some ( NonterminalKind :: Path ) ) {
751
+ true
752
+ } else {
753
+ false
765
754
}
766
-
767
- false
768
755
}
769
756
770
757
/// Is the token an interpolated block (`$b:block`)?
@@ -790,7 +777,7 @@ impl Token {
790
777
pub fn is_path_start ( & self ) -> bool {
791
778
self == & PathSep
792
779
|| self . is_qpath_start ( )
793
- || self . is_whole_path ( )
780
+ || matches ! ( self . is_metavar_seq ( ) , Some ( NonterminalKind :: Path ) )
794
781
|| self . is_path_segment_keyword ( )
795
782
|| self . is_ident ( ) && !self . is_reserved_ident ( )
796
783
}
@@ -943,7 +930,6 @@ pub enum Nonterminal {
943
930
NtBlock ( P < ast:: Block > ) ,
944
931
NtExpr ( P < ast:: Expr > ) ,
945
932
NtLiteral ( P < ast:: Expr > ) ,
946
- NtPath ( P < ast:: Path > ) ,
947
933
}
948
934
949
935
#[ derive( Debug , Copy , Clone , PartialEq , Eq , Encodable , Decodable , Hash , HashStable_Generic ) ]
@@ -1042,7 +1028,6 @@ impl Nonterminal {
1042
1028
match self {
1043
1029
NtBlock ( block) => block. span ,
1044
1030
NtExpr ( expr) | NtLiteral ( expr) => expr. span ,
1045
- NtPath ( path) => path. span ,
1046
1031
}
1047
1032
}
1048
1033
@@ -1051,7 +1036,6 @@ impl Nonterminal {
1051
1036
NtBlock ( ..) => "block" ,
1052
1037
NtExpr ( ..) => "expression" ,
1053
1038
NtLiteral ( ..) => "literal" ,
1054
- NtPath ( ..) => "path" ,
1055
1039
}
1056
1040
}
1057
1041
}
@@ -1072,7 +1056,6 @@ impl fmt::Debug for Nonterminal {
1072
1056
NtBlock ( ..) => f. pad ( "NtBlock(..)" ) ,
1073
1057
NtExpr ( ..) => f. pad ( "NtExpr(..)" ) ,
1074
1058
NtLiteral ( ..) => f. pad ( "NtLiteral(..)" ) ,
1075
- NtPath ( ..) => f. pad ( "NtPath(..)" ) ,
1076
1059
}
1077
1060
}
1078
1061
}
0 commit comments