@@ -532,8 +532,7 @@ impl Token {
532
532
Pound => true , // expression attributes
533
533
Interpolated ( ref nt) => matches ! ( & * * nt, NtLiteral ( ..) |
534
534
NtExpr ( ..) |
535
- NtBlock ( ..) |
536
- NtPath ( ..) ) ,
535
+ NtBlock ( ..) ) ,
537
536
OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
538
537
NonterminalKind :: Block |
539
538
NonterminalKind :: Expr |
@@ -560,9 +559,7 @@ impl Token {
560
559
| DotDot | DotDotDot | DotDotEq // ranges
561
560
| Lt | BinOp ( Shl ) // associated path
562
561
| PathSep => true , // global path
563
- Interpolated ( ref nt) => matches ! ( & * * nt, NtLiteral ( ..) |
564
- NtBlock ( ..) |
565
- NtPath ( ..) ) ,
562
+ Interpolated ( ref nt) => matches ! ( & * * nt, NtLiteral ( ..) | NtBlock ( ..) ) ,
566
563
OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
567
564
NonterminalKind :: Block |
568
565
NonterminalKind :: PatParam { .. } |
@@ -589,7 +586,6 @@ impl Token {
589
586
Lifetime ( ..) | // lifetime bound in trait object
590
587
Lt | BinOp ( Shl ) | // associated path
591
588
PathSep => true , // global path
592
- Interpolated ( ref nt) => matches ! ( & * * nt, NtPath ( ..) ) ,
593
589
OpenDelim ( Delimiter :: Invisible ( InvisibleOrigin :: MetaVar (
594
590
NonterminalKind :: Ty |
595
591
NonterminalKind :: Path
@@ -721,29 +717,20 @@ impl Token {
721
717
self . ident ( ) . is_some_and ( |( ident, _) | ident. name == name)
722
718
}
723
719
724
- /// Returns `true` if the token is an interpolated path.
725
- fn is_whole_path ( & self ) -> bool {
726
- if let Interpolated ( nt) = & self . kind
727
- && let NtPath ( ..) = & * * nt
728
- {
729
- return true ;
730
- }
731
-
732
- false
733
- }
734
-
735
720
/// Would `maybe_whole_expr` in `parser.rs` return `Ok(..)`?
736
721
/// That is, is this a pre-parsed expression dropped into the token stream
737
722
/// (which happens while parsing the result of macro expansion)?
738
723
pub fn is_whole_expr ( & self ) -> bool {
739
724
#[ allow( irrefutable_let_patterns) ] // njn: temp
740
725
if let Interpolated ( nt) = & self . kind
741
- && let NtExpr ( _) | NtLiteral ( _) | NtPath ( _ ) | NtBlock ( _ ) = & * * nt
726
+ && let NtExpr ( _) | NtLiteral ( _) = & * * nt
742
727
{
743
- return true ;
728
+ true
729
+ } else if matches ! ( self . is_metavar_seq( ) , Some ( NonterminalKind :: Path ) ) {
730
+ true
731
+ } else {
732
+ false
744
733
}
745
-
746
- false
747
734
}
748
735
749
736
/// Is the token an interpolated block (`$b:block`)?
@@ -769,7 +756,7 @@ impl Token {
769
756
pub fn is_path_start ( & self ) -> bool {
770
757
self == & PathSep
771
758
|| self . is_qpath_start ( )
772
- || self . is_whole_path ( )
759
+ || matches ! ( self . is_metavar_seq ( ) , Some ( NonterminalKind :: Path ) )
773
760
|| self . is_path_segment_keyword ( )
774
761
|| self . is_ident ( ) && !self . is_reserved_ident ( )
775
762
}
@@ -922,7 +909,6 @@ pub enum Nonterminal {
922
909
NtBlock ( P < ast:: Block > ) ,
923
910
NtExpr ( P < ast:: Expr > ) ,
924
911
NtLiteral ( P < ast:: Expr > ) ,
925
- NtPath ( P < ast:: Path > ) ,
926
912
}
927
913
928
914
#[ derive( Debug , Copy , Clone , PartialEq , Eq , Encodable , Decodable , Hash , HashStable_Generic ) ]
@@ -1008,7 +994,6 @@ impl Nonterminal {
1008
994
match self {
1009
995
NtBlock ( block) => block. span ,
1010
996
NtExpr ( expr) | NtLiteral ( expr) => expr. span ,
1011
- NtPath ( path) => path. span ,
1012
997
}
1013
998
}
1014
999
@@ -1017,7 +1002,6 @@ impl Nonterminal {
1017
1002
NtBlock ( ..) => "block" ,
1018
1003
NtExpr ( ..) => "expression" ,
1019
1004
NtLiteral ( ..) => "literal" ,
1020
- NtPath ( ..) => "path" ,
1021
1005
}
1022
1006
}
1023
1007
}
@@ -1038,7 +1022,6 @@ impl fmt::Debug for Nonterminal {
1038
1022
NtBlock ( ..) => f. pad ( "NtBlock(..)" ) ,
1039
1023
NtExpr ( ..) => f. pad ( "NtExpr(..)" ) ,
1040
1024
NtLiteral ( ..) => f. pad ( "NtLiteral(..)" ) ,
1041
- NtPath ( ..) => f. pad ( "NtPath(..)" ) ,
1042
1025
}
1043
1026
}
1044
1027
}
0 commit comments