about summary refs log tree commit diff
path: root/compiler/rustc_ast/src/token.rs
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2025-02-21 16:47:07 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2025-02-21 16:48:01 +1100
commit0f490b040af82820e423a7e71e0e2e1f6ca7ab57 (patch)
tree51e1a0678df173a482e283e176903ea3d3a0006e /compiler/rustc_ast/src/token.rs
parent76b04437be91069260c72a6d59d130a4e127a9a8 (diff)
downloadrust-0f490b040af82820e423a7e71e0e2e1f6ca7ab57.tar.gz
rust-0f490b040af82820e423a7e71e0e2e1f6ca7ab57.zip
Avoid snapshotting the parser in `parse_path_inner`.
Diffstat (limited to 'compiler/rustc_ast/src/token.rs')
-rw-r--r--compiler/rustc_ast/src/token.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/rustc_ast/src/token.rs b/compiler/rustc_ast/src/token.rs
index 8ac6dc3b4d8..97d121909f8 100644
--- a/compiler/rustc_ast/src/token.rs
+++ b/compiler/rustc_ast/src/token.rs
@@ -84,7 +84,9 @@ pub enum MetaVarKind {
         // This field is needed for `Token::can_begin_string_literal`.
         can_begin_string_literal: bool,
     },
-    Ty,
+    Ty {
+        is_path: bool,
+    },
     Ident,
     Lifetime,
     Literal,
@@ -104,7 +106,7 @@ impl fmt::Display for MetaVarKind {
             MetaVarKind::Pat(PatParam { inferred: false }) => sym::pat_param,
             MetaVarKind::Expr { kind: Expr2021 { inferred: true } | Expr, .. } => sym::expr,
             MetaVarKind::Expr { kind: Expr2021 { inferred: false }, .. } => sym::expr_2021,
-            MetaVarKind::Ty => sym::ty,
+            MetaVarKind::Ty { .. } => sym::ty,
             MetaVarKind::Ident => sym::ident,
             MetaVarKind::Lifetime => sym::lifetime,
             MetaVarKind::Literal => sym::literal,
@@ -666,7 +668,7 @@ impl Token {
                 MetaVarKind::Meta |
                 MetaVarKind::Pat(_) |
                 MetaVarKind::Path |
-                MetaVarKind::Ty
+                MetaVarKind::Ty { .. }
             ))) => true,
             _ => false,
         }
@@ -689,7 +691,7 @@ impl Token {
             PathSep                      => true, // global path
             Interpolated(ref nt) => matches!(&**nt, NtPath(..)),
             OpenDelim(Delimiter::Invisible(InvisibleOrigin::MetaVar(
-                MetaVarKind::Ty |
+                MetaVarKind::Ty { .. } |
                 MetaVarKind::Path
             ))) => true,
             // For anonymous structs or unions, which only appear in specific positions