diff options
| author | bors <bors@rust-lang.org> | 2025-02-28 21:32:39 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-02-28 21:32:39 +0000 |
| commit | aa3c2d73eff57d6b019c26a1e9aa8afd8bc186ad (patch) | |
| tree | f01174f5b149504484f51489742f4b1b955d2b0d /compiler/rustc_parse/src/parser/path.rs | |
| parent | 287487624357c19b22d27aa3ed584b8ccd080b4d (diff) | |
| parent | 50076cdeb9fd1ecf2d85e481dc284525f9c509db (diff) | |
| download | rust-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/path.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/path.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/rustc_parse/src/parser/path.rs b/compiler/rustc_parse/src/parser/path.rs index c24305ea9a8..1280a1cd312 100644 --- a/compiler/rustc_parse/src/parser/path.rs +++ b/compiler/rustc_parse/src/parser/path.rs @@ -15,9 +15,9 @@ use tracing::debug; use super::ty::{AllowPlus, RecoverQPath, RecoverReturnSign}; use super::{Parser, Restrictions, TokenType}; -use crate::errors::{PathSingleColon, PathTripleColon}; +use crate::errors::{self, PathSingleColon, PathTripleColon}; +use crate::exp; use crate::parser::{CommaRecoveryMode, RecoverColon, RecoverComma}; -use crate::{errors, exp, maybe_whole}; /// Specifies how to parse a path. #[derive(Copy, Clone, PartialEq)] @@ -194,7 +194,11 @@ impl<'a> Parser<'a> { } }; - maybe_whole!(self, NtPath, |path| reject_generics_if_mod_style(self, path.into_inner())); + if let Some(path) = + self.eat_metavar_seq(MetaVarKind::Path, |this| this.parse_path(PathStyle::Type)) + { + return Ok(reject_generics_if_mod_style(self, path)); + } // If we have a `ty` metavar in the form of a path, reparse it directly as a path, instead // of reparsing it as a `ty` and then extracting the path. |
