Skip to content

Replace manual AttributeParser construction by parse_limited_all - #166386

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
JonathanBrouwer:parse-all
Nov 24, 2026
Merged

rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
JonathanBrouwer:parse-all

Conversation

@JonathanBrouwer

Copy link
Copy Markdown
Member

It's interesting to see this old code, of when attribute parsers were just introduced, hihi :3

r? @jdonszelmann because this has your FIXMEs

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 23, 2026
@rustbot

rustbot commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

jdonszelmann is currently at their maximum review capacity.
They may take a while to respond.

|_lint_id, _span, _kind| {
// FIXME(jdonszelmann): emit lints here properly
// NOTE that before new attribute parsing, they didn't happen either
// but it would be nice if we could change that.

@JonathanBrouwer JonathanBrouwer Nov 23, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should in fact not emit lints here, they're emitted during lowering so emitting them here would duplicate them

View changes since the review

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, not if the macro isn't #[macro_export]ed right? This may be a problem.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think macro definitions always end up in the HIR, regardless of whether they're exported.
So they should always be checked

// FIXME(jdonszelmann) don't care about tools here maybe? Just parse what we can.
// Does that prevents errors from happening? maybe
let mut parser = AttributeParser::new(
let attrs = AttributeParser::parse_limited_all(

@jdonszelmann jdonszelmann Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs of parse_limited_all says:

Therefore, if parse_filter is None, then features must be provided.

We should assert this hehe

View changes since the review

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otherwise it's easy to accidentally pass tests if you happen not to put any attributes on an item where features matter

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, good idea

@jdonszelmann jdonszelmann left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you like to add the assertion? otherwise r=me

View changes since this review

@rustbot

rustbot commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann

@rustbot rustbot added the A-attributes Area: Attributes (`#[…]`, `#![…]`) label Nov 23, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Member Author

@bors r=jdonszelmann

@rust-bors

rust-bors Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 9ff59b0 has been tentatively approved by jdonszelmann

It will be put into the queue for this repository once PR CI succeeds.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 23, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Nov 23, 2026
…zelmann

Replace manual `AttributeParser` construction by `parse_limited_all`

It's interesting to see this old code, of when attribute parsers were just introduced, hihi :3

r? @jdonszelmann because this has your FIXMEs
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Nov 23, 2026
…zelmann

Replace manual `AttributeParser` construction by `parse_limited_all`

It's interesting to see this old code, of when attribute parsers were just introduced, hihi :3

r? @jdonszelmann because this has your FIXMEs
@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 23, 2026
@rust-bors

This comment has been minimized.

@rustbot

rustbot commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@JonathanBrouwer

Copy link
Copy Markdown
Member Author

@bors r=jdonszelmann

@rust-bors

rust-bors Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 5a0c4ea has been tentatively approved by jdonszelmann

It will be put into the queue for this repository once PR CI succeeds.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 23, 2026
rust-bors Bot pushed a commit that referenced this pull request Nov 24, 2026
Rollup of 11 pull requests

Successful merges:

 - #165769 (Fix invalid instantiation of fake intrinsic bodies)
 - #166374 (Undo accidental duplication checking for attributes on macro calls)
 - #166386 (Replace manual `AttributeParser` construction by `parse_limited_all`)
 - #162565 (Add `c_buffer_length` lint helper)
 - #166096 (llvm-wrapper: Pass more arguments to PreCodeGenCallback)
 - #166395 (std: fix positioned read/write on VxWorks)
 - #166404 (Change `ChildExt::kill_process_group` to be `&self`)
 - #166405 (Check for errors before encoding metadata)
 - #166412 (std: Fix locking test on GNU/Hurd)
 - #166413 (std: Fix symlink chmod test on GNU/Hurd)
 - #166421 (core: Stabilize `float_bits_const`)
@rust-bors
rust-bors Bot merged commit 9d577e6 into rust-lang:main Nov 24, 2026
14 checks passed
@rustbot rustbot added this to the 1.102.0 milestone Nov 24, 2026
rust-bors Bot pushed a commit that referenced this pull request Nov 24, 2026
Rollup merge of #166386 - JonathanBrouwer:parse-all, r=jdonszelmann

Replace manual `AttributeParser` construction by `parse_limited_all`

It's interesting to see this old code, of when attribute parsers were just introduced, hihi :3

r? @jdonszelmann because this has your FIXMEs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants