Skip to content

Fix unused attribute duplication for lint attributes - #165249

Open
JonathanBrouwer wants to merge 2 commits into
rust-lang:mainfrom
JonathanBrouwer:duplicate-unused
Open

JonathanBrouwer wants to merge 2 commits into
rust-lang:mainfrom
JonathanBrouwer:duplicate-unused

Conversation

@JonathanBrouwer

Copy link
Copy Markdown
Member

r? @mejrs

@rustbot

rustbot commented Oct 31, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann

@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 Oct 31, 2026
@mejrs

mejrs commented Nov 2, 2026

Copy link
Copy Markdown
Member

I think the motivation for the assertion is somewhat weak. Did you encounter this situation in this PR?

@JonathanBrouwer

JonathanBrouwer commented Nov 4, 2026 •

Copy link
Copy Markdown
Member Author

Yes, specifically lint attributes parsed during early linting cannot themselves emit lints, without the parse_filter.is_none() check the assertion triggers
https://github.com/rust-lang/rust/pull/165249/changes#diff-f108051d119300655064d5988094ba485d04880e8669944bbc484f35c49b6743R120

This specific problem should be fixed after #164918, but I thought the assertion could be useful to prevent similar problems in the future.

I also encountered this problem when trying to emulate the old behaviour here:
#164918 (comment)

This branch has not been deployed

No deployments
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-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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants