diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-04-18 20:09:37 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-02-28 08:42:14 +1100 |
| commit | 50076cdeb9fd1ecf2d85e481dc284525f9c509db (patch) | |
| tree | bc7c5e4524974d75bd6c5f75e08bb89846c0ed5b /compiler/rustc_attr_parsing/src | |
| parent | 7ea59e053bed52249ba8f42cbdbc7301312197e3 (diff) | |
| download | rust-50076cdeb9fd1ecf2d85e481dc284525f9c509db.tar.gz rust-50076cdeb9fd1ecf2d85e481dc284525f9c509db.zip | |
Remove `NtPath`.
Diffstat (limited to 'compiler/rustc_attr_parsing/src')
| -rw-r--r-- | compiler/rustc_attr_parsing/src/parser.rs | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/compiler/rustc_attr_parsing/src/parser.rs b/compiler/rustc_attr_parsing/src/parser.rs index 2604188bca2..96fc9d7d9ac 100644 --- a/compiler/rustc_attr_parsing/src/parser.rs +++ b/compiler/rustc_attr_parsing/src/parser.rs @@ -477,32 +477,21 @@ impl<'a> MetaItemListParserContext<'a> { // or a path. let path = - if let Some(TokenTree::Token(Token { kind: token::Interpolated(nt), span, .. }, _)) = + if let Some(TokenTree::Token(Token { kind: token::Interpolated(_), span, .. }, _)) = self.inside_delimiters.peek() { - match &**nt { - // an already interpolated path from a macro expansion is a path, no need to parse - // one from tokens - token::Nonterminal::NtPath(path) => { - self.inside_delimiters.next(); - - AttrPath::from_ast(path) - } - _ => { - self.inside_delimiters.next(); - // we go into this path if an expr ended up in an attribute that - // expansion did not turn into a literal. Say, `#[repr(align(macro!()))]` - // where the macro didn't expand to a literal. An error is already given - // for this at this point, and then we do continue. This makes this path - // reachable... - let e = self.dcx.span_delayed_bug( - *span, - "expr in place where literal is expected (builtin attr parsing)", - ); - - return Some(MetaItemOrLitParser::Err(*span, e)); - } - } + self.inside_delimiters.next(); + // We go into this path if an expr ended up in an attribute that + // expansion did not turn into a literal. Say, `#[repr(align(macro!()))]` + // where the macro didn't expand to a literal. An error is already given + // for this at this point, and then we do continue. This makes this path + // reachable... + let e = self.dcx.span_delayed_bug( + *span, + "expr in place where literal is expected (builtin attr parsing)", + ); + + return Some(MetaItemOrLitParser::Err(*span, e)); } else { self.next_path()? }; |
