Skip to content

Duplicate attribute diagnostic cleanups - #165935

Merged
rust-bors[bot] merged 3 commits into
rust-lang:mainfrom
petrak-at-canonical:duplicate-attr-diagnostic
Nov 19, 2026
Merged

rust-bors[bot] merged 3 commits into
rust-lang:mainfrom
petrak-at-canonical:duplicate-attr-diagnostic

Conversation

@petrak-at-canonical

Copy link
Copy Markdown
Contributor

Currently there are two different diagnostics for when you can't have a duplicate attribute on an item, UnusedDuplicate and UnusedMultiple. This PR deduplicates their behavior into UnusedMultiple. In a separate commit, it renames UnusedMultiple to DuplicateAttribute, a more sensible name.

Separately, the third commit fixes a small issue where diagnostics about attributes would be printed with .. as a path separator instead of ::

Thanks to Jonathan Brouwer for the suggestion to work on this!

r? @JonathanBrouwer

@rustbot

rustbot commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann, @JonathanBrouwer

Some changes occurred to diagnostic attributes.

cc @mejrs

@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 Nov 13, 2026
@rust-log-analyzer

This comment has been minimized.

@petrak-at-canonical

Copy link
Copy Markdown
Contributor Author

I have the failures in rustdoc-ui fixed locally. Would you like the fixed version with or without commit 2? (the one that changes the names and so creates a very large diff)

Right now I cleverly have engineered a workflow where I have to create two versions of every patch

@JonathanBrouwer JonathanBrouwer left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A few nitpicks, other than that this is great, thanks a lot!

View changes since this review

@rustbot rustbot 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-review Status: Awaiting review from the assignee but also interested parties. labels Nov 14, 2026
@rustbot

rustbot commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@JonathanBrouwer JonathanBrouwer left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@rust-bors

rust-bors Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 6de3ba1 has been tentatively approved by JonathanBrouwer

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 16, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Nov 16, 2026
…-diagnostic, r=JonathanBrouwer

Duplicate attribute diagnostic cleanups

Currently there are two different diagnostics for when you can't have a duplicate attribute on an item, `UnusedDuplicate` and `UnusedMultiple`. This PR deduplicates their behavior into `UnusedMultiple`. In a separate commit, it renames `UnusedMultiple` to `DuplicateAttribute`, a more sensible name.

Separately, the third commit fixes a small issue where diagnostics about attributes would be printed with `..` as a path separator instead of `::`

Thanks to Jonathan Brouwer for the suggestion to work on this!

r? @JonathanBrouwer
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Nov 16, 2026
…-diagnostic, r=JonathanBrouwer

Duplicate attribute diagnostic cleanups

Currently there are two different diagnostics for when you can't have a duplicate attribute on an item, `UnusedDuplicate` and `UnusedMultiple`. This PR deduplicates their behavior into `UnusedMultiple`. In a separate commit, it renames `UnusedMultiple` to `DuplicateAttribute`, a more sensible name.

Separately, the third commit fixes a small issue where diagnostics about attributes would be printed with `..` as a path separator instead of `::`

Thanks to Jonathan Brouwer for the suggestion to work on this!

r? @JonathanBrouwer
rust-bors Bot pushed a commit that referenced this pull request Nov 16, 2026
…uwer

Rollup of 13 pull requests

Successful merges:

 - #166054 (stdarch subtree update)
 - #165289 (lexer: Update to Unicode 18)
 - #165960 (alloctests: use thread-local in `c_str_alloc_error`)
 - #166002 (#[optimize]: keep low opt levels unoptimized)
 - #166049 (rustc_target: Require altivec feature for ELFv2 powerpc64 targets)
 - #165200 (fix abi kind of thumb windows targets)
 - #165935 (Duplicate attribute diagnostic cleanups)
 - #165999 (Update TPDE submodule)
 - #166045 (rustdoc: Correctly filter deref impls on type aliases)
 - #166063 (Fix bad hyperlink)
 - #166066 (Update books)
 - #166072 (simplify Appearances iter)
 - #166075 (Remove dead code emitting `UnusedBuiltinAttribute`)
@Zalathar

Copy link
Copy Markdown
Member

@bors r-
@bors try jobs=test-x86_64-mingw-1

@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 17, 2026
@rust-bors

rust-bors Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

This PR was contained in a rollup (#166080), which was unapproved.

View changes since this unapproval

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Nov 17, 2026
…, r=<try>

Duplicate attribute diagnostic cleanups


try-job: test-x86_64-mingw-1
@rust-bors

rust-bors Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 0f4128d failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment has been minimized.

…teAttribute`

Currently, `UnusedDuplicate` is used when a duplicate attribute is a warning,
and `UnusedMultiple` is used when it is an error.
This commit removes the redundancy in favor of a new lint, `DuplicateAttribute`.

The error messages now look like "duplicate `X` attributes", instead of
"multiple `X` attributes" or "duplicate attribute".

Thanks to @JonathanBrouwer for the suggestion to work on this
@rustbot

rustbot commented Nov 18, 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.

@petrak-at-canonical

Copy link
Copy Markdown
Contributor Author

Rebased, and fixed tests on x86_64-pc-windows-gnu. (I think. Cross-compiling tests does not work very well on my computer for some reason)

@JonathanBrouwer

Copy link
Copy Markdown
Member

@bors try jobs=test-x86_64-mingw-1,test-aarch64-apple-1
@bors r+

rust-bors Bot pushed a commit that referenced this pull request Nov 18, 2026
…, r=<try>

Duplicate attribute diagnostic cleanups


try-job: test-x86_64-mingw-1
try-job: test-aarch64-apple-1
@rust-bors

This comment has been minimized.

@rust-bors

rust-bors Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 3dc32c0 has been tentatively approved by JonathanBrouwer

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 18, 2026
@rust-bors

rust-bors Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 24abedd (24abeddd077fc366421bab1fd8b7955f01424613)
Base parent: 412be32 (412be32a6a189d9a28922beee178bc0abee9d492)

rust-bors Bot pushed a commit that referenced this pull request Nov 18, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - #165913 (MirPatch: reduce new statement insertion complexity)
 - #166081 (test `feature(asm_const_ptr)` with a vtable)
 - #166094 (Chain the spans of qualified paths instead of having a first-to-last scheme )
 - #166113 (Fix dead-code marking dead enum variants as live)
 - #166118 (rustc_target: catch up with LLVM 24 movement on ppc64le bsd data layout)
 - #166155 (windows seek_write: document interaction with append mode)
 - #165935 (Duplicate attribute diagnostic cleanups)
 - #165948 (lint: Avoid unused_parens warning for ref patterns binding an identifier)
 - #166018 (`rustc_mir_build`: de-duplicate `local_temp_lifetime()`)
 - #166111 (Add `cd` alias to `std::env::set_current_dir`)
 - #166157 (Don't recover invalid literals in attribute parsing)
rust-bors Bot pushed a commit that referenced this pull request Nov 19, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - #165913 (MirPatch: reduce new statement insertion complexity)
 - #166081 (test `feature(asm_const_ptr)` with a vtable)
 - #166094 (Chain the spans of qualified paths instead of having a first-to-last scheme )
 - #166113 (Fix dead-code marking dead enum variants as live)
 - #166118 (rustc_target: catch up with LLVM 24 movement on ppc64le bsd data layout)
 - #166155 (windows seek_write: document interaction with append mode)
 - #165935 (Duplicate attribute diagnostic cleanups)
 - #165948 (lint: Avoid unused_parens warning for ref patterns binding an identifier)
 - #166018 (`rustc_mir_build`: de-duplicate `local_temp_lifetime()`)
 - #166111 (Add `cd` alias to `std::env::set_current_dir`)
 - #166157 (Don't recover invalid literals in attribute parsing)
@rust-bors
rust-bors Bot merged commit e069349 into rust-lang:main Nov 19, 2026
15 checks passed
@rustbot rustbot added this to the 1.102.0 milestone Nov 19, 2026
rust-bors Bot pushed a commit that referenced this pull request Nov 19, 2026
Rollup merge of #165935 - petrak-at-canonical:duplicate-attr-diagnostic, r=JonathanBrouwer

Duplicate attribute diagnostic cleanups

Currently there are two different diagnostics for when you can't have a duplicate attribute on an item, `UnusedDuplicate` and `UnusedMultiple`. This PR deduplicates their behavior into `UnusedMultiple`. In a separate commit, it renames `UnusedMultiple` to `DuplicateAttribute`, a more sensible name.

Separately, the third commit fixes a small issue where diagnostics about attributes would be printed with `..` as a path separator instead of `::`

Thanks to Jonathan Brouwer for the suggestion to work on this!

r? @JonathanBrouwer
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.

5 participants