about summary refs log tree commit diff
path: root/compiler/rustc_attr_parsing/src/parser.rs
AgeCommit message (Collapse)AuthorLines
2025-08-28Improve error messages around invalid literals in attribute argumentsJonathan Brouwer-23/+36
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-24fix ICE on stable related to attrs on macrosJana Dönszelmann-10/+10
2025-08-24Allow errors to be emitted as fatal during attribute parsingJana Dönszelmann-10/+13
2025-08-22Rewrite the new attribute parserJonathan Brouwer-232/+248
2025-06-23Port `#[rustc_skip_during_method_dispatch]` to the new attribute systemPavel Grigorenko-3/+9
2025-06-23move naked checks out of check_attr.rsJana Dönszelmann-0/+8
2025-06-12introduce new lint infraJana Dönszelmann-7/+7
lint on duplicates during attribute parsing To do this we stuff them in the diagnostic context to be emitted after hir is constructed
2025-06-04Rollup merge of #141271 - nnethercote:attr-streamline, r=jdonszelmannMatthias Krüger-54/+8
Streamline some attr parsing APIs r? ``@jdonszelmann``
2025-05-21Rename `MetaItemParser::path_without_args` as `MetaItemParser::path`.Nicholas Nethercote-3/+3
And avoid the clone.
2025-05-21Remove `MetaItemParser::{path,deconstruct}`.Nicholas Nethercote-14/+5
They're equivalent, and `path` is unused, and `deconstruct` has only one call site outside of `path`.
2025-05-21Remove `MetaItemParser::{word,word_without_args,path_is}`.Nicholas Nethercote-23/+0
They are unused.
2025-05-21Remove an unnecessary lifetime.Nicholas Nethercote-1/+1
2025-05-20Remove `MetaItemListParser::all_{word,path}_list`, which are unused.Nicholas Nethercote-14/+0
2025-05-20Avoid `rustc_span::` qualifiers.Nicholas Nethercote-2/+1
In several files they are entirely unnecessary, with the relevant names already imported. And in a few I have added the necessary `use` item.
2025-05-07Eliminate `word_or_empty` methods.Nicholas Nethercote-13/+2
To get rid of the `Ident::empty` uses. This requires introducing `PathParser::word_sym`, as an alternative to `PathParser::word`.
2025-04-21Remove `token::{Open,Close}Delim`.Nicholas Nethercote-3/+1
By replacing them with `{Open,Close}{Param,Brace,Bracket,Invisible}`. PR #137902 made `ast::TokenKind` more like `lexer::TokenKind` by replacing the compound `BinOp{,Eq}(BinOpToken)` variants with fieldless variants `Plus`, `Minus`, `Star`, etc. This commit does a similar thing with delimiters. It also makes `ast::TokenKind` more similar to `parser::TokenType`. This requires a few new methods: - `TokenKind::is_{,open_,close_}delim()` replace various kinds of pattern matches. - `Delimiter::as_{open,close}_token_kind` are used to convert `Delimiter` values to `TokenKind`. Despite these additions, it's a net reduction in lines of code. This is because e.g. `token::OpenParen` is so much shorter than `token::OpenDelim(Delimiter::Parenthesis)` that many multi-line forms reduce to single line forms. And many places where the number of lines doesn't change are still easier to read, just because the names are shorter, e.g.: ``` - } else if self.token != token::CloseDelim(Delimiter::Brace) { + } else if self.token != token::CloseBrace { ```
2025-04-02Remove `NtBlock`, `Nonterminal`, and `TokenKind::Interpolated`.Nicholas Nethercote-19/+1
`NtBlock` is the last remaining variant of `Nonterminal`, so once it is gone then `Nonterminal` can be removed as well.
2025-03-12Introduce `sym::dummy` and `Ident::dummy`.Nicholas Nethercote-2/+2
The idea is to identify cases of symbols/identifiers that are not expected to be used. There isn't a perfectly sharp line between "dummy" and "not dummy", but I think it's useful nonetheless.
2025-03-06Rollup merge of #137758 - jdonszelmann:fix-137662, r=nnethercoteMichael Goulet-0/+9
fix usage of ty decl macro fragments in attributes See the test case. Due to one missing code path (and also the changes in #137517), using $ty or other specific fragments as part of an attr wouldn't work. $tt used to work since it wouldn't be parsed anywhere along the way. Closes #137662
2025-02-28add test to reproduce #137662 (using ty decl macro fragment in an attr) and ↵Jana Dönszelmann-0/+9
fix it
2025-02-28Remove `NtPath`.Nicholas Nethercote-24/+13
2025-02-28Remove `NtMeta`.Nicholas Nethercote-9/+0
Note: there was an existing code path involving `Interpolated` in `MetaItem::from_tokens` that was dead. This commit transfers that to the new form, but puts an `unreachable!` call inside it.
2025-02-25fix #137589Jana Dönszelmann-5/+8
2025-02-24add test to verify that #132391 can be closedJana Dönszelmann-4/+3
2025-02-24Introduce new parsing infrastructure and types for parsed attributesJana Dönszelmann-0/+625
fixup docs in parser