Skip to content

attr parsing: make sure we pass the right target when errors could be emitted#154876

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
scrabsha:push-ymvvtywqttlq
Apr 6, 2026
Merged

attr parsing: make sure we pass the right target when errors could be emitted#154876
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
scrabsha:push-ymvvtywqttlq

Conversation

@scrabsha
Copy link
Copy Markdown
Contributor

@scrabsha scrabsha commented Apr 6, 2026

Found this while debugging something on #154590. AFAIK there is no user-observable change, but the code was definitely wrong (I tested it by adding an assert!(matches!(should_emit, ShouldEmit::Nothing)); at the beginning of parse_limited_should_emit.

I did a bit of archeology and it looks like this was introduced in #137729. I couldn't find any reason for this from the discussion that occurred back then.

r? jdonszelmann

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 6, 2026

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann, @JonathanBrouwer

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) 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 Apr 6, 2026
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

all the changes in this file are for crate-level attributes, hence the Target::crate.

Copy link
Copy Markdown
Contributor

@JonathanBrouwer JonathanBrouwer left a comment

Choose a reason for hiding this comment

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

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 6, 2026

📌 Commit 6be1404 has been approved by JonathanBrouwer

It is now in the queue for this repository.

@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 Apr 6, 2026
rust-bors bot pushed a commit that referenced this pull request Apr 6, 2026
…uwer

Rollup of 3 pull requests

Successful merges:

 - #154554 (emit error on `#[track_caller]` with `extern fn`)
 - #154858 (Change api of formatting diagnostic attribute strings.)
 - #154876 (attr parsing: make sure we pass the right target when errors could be emitted)
rust-timer added a commit that referenced this pull request Apr 6, 2026
Rollup merge of #154876 - scrabsha:push-ymvvtywqttlq, r=JonathanBrouwer

attr parsing: make sure we pass the right target when errors could be emitted
@rust-bors rust-bors bot merged commit 2973fd5 into rust-lang:main Apr 6, 2026
11 checks passed
@rustbot rustbot added this to the 1.96.0 milestone Apr 6, 2026
@scrabsha scrabsha deleted the push-ymvvtywqttlq branch April 7, 2026 13:53
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.

4 participants