about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/expr.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-02-28 21:32:39 +0000
committerbors <bors@rust-lang.org>2025-02-28 21:32:39 +0000
commitaa3c2d73eff57d6b019c26a1e9aa8afd8bc186ad (patch)
treef01174f5b149504484f51489742f4b1b955d2b0d /compiler/rustc_parse/src/parser/expr.rs
parent287487624357c19b22d27aa3ed584b8ccd080b4d (diff)
parent50076cdeb9fd1ecf2d85e481dc284525f9c509db (diff)
downloadrust-aa3c2d73eff57d6b019c26a1e9aa8afd8bc186ad.tar.gz
rust-aa3c2d73eff57d6b019c26a1e9aa8afd8bc186ad.zip
Auto merge of #137517 - nnethercote:rm-NtPat-NtItem-NtStmt, r=petrochenkov
Remove `NtPat`, `NtMeta`, and `NtPath`

Another part of #124141.

r? `@petrochenkov`
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
-rw-r--r--compiler/rustc_parse/src/parser/expr.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index c934c1e36d5..ef29ac2719d 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -4,7 +4,7 @@ use core::mem;
 use core::ops::{Bound, ControlFlow};
 
 use ast::mut_visit::{self, MutVisitor};
-use ast::token::IdentIsRaw;
+use ast::token::{IdentIsRaw, MetaVarKind};
 use ast::{CoroutineKind, ForLoopKind, GenBlockKind, MatchKind, Pat, Path, PathSegment, Recovered};
 use rustc_ast::ptr::P;
 use rustc_ast::token::{self, Delimiter, Token, TokenKind};
@@ -1344,6 +1344,7 @@ impl<'a> Parser<'a> {
     fn parse_expr_bottom(&mut self) -> PResult<'a, P<Expr>> {
         maybe_recover_from_interpolated_ty_qpath!(self, true);
 
+        let span = self.token.span;
         if let token::Interpolated(nt) = &self.token.kind {
             match &**nt {
                 token::NtExpr(e) | token::NtLiteral(e) => {
@@ -1351,11 +1352,6 @@ impl<'a> Parser<'a> {
                     self.bump();
                     return Ok(e);
                 }
-                token::NtPath(path) => {
-                    let path = (**path).clone();
-                    self.bump();
-                    return Ok(self.mk_expr(self.prev_token.span, ExprKind::Path(None, path)));
-                }
                 token::NtBlock(block) => {
                     let block = block.clone();
                     self.bump();
@@ -1363,6 +1359,10 @@ impl<'a> Parser<'a> {
                 }
                 _ => {}
             };
+        } else if let Some(path) = self.eat_metavar_seq(MetaVarKind::Path, |this| {
+            this.collect_tokens_no_attrs(|this| this.parse_path(PathStyle::Type))
+        }) {
+            return Ok(self.mk_expr(span, ExprKind::Path(None, path)));
         }
 
         // Outer attributes are already parsed and will be