Skip to content

Make OnDuplicate::Error the default for attributes#155308

Open
JonathanBrouwer wants to merge 2 commits intorust-lang:mainfrom
JonathanBrouwer:duplicate_errs
Open

Make OnDuplicate::Error the default for attributes#155308
JonathanBrouwer wants to merge 2 commits intorust-lang:mainfrom
JonathanBrouwer:duplicate_errs

Conversation

@JonathanBrouwer
Copy link
Copy Markdown
Contributor

This makes two changes, in separate commits for reviewability:

  • Changes all unstable attributes that are currently OnDuplicate::Warn to error.
  • Makes OnDuplicate::Error the default and removes the explicit ON_DUPLICATE for ones that currently already error

r? @jdonszelmann

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 14, 2026

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 Apr 14, 2026
error: multiple `no_core` attributes
--> $DIR/malformed-no-std.rs:13:1
|
LL | #![no_core("bar")]
Copy link
Copy Markdown
Contributor

@jdonszelmann jdonszelmann Apr 15, 2026

Choose a reason for hiding this comment

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

for valid input to no_core, so when there's not another error already, did multiple attributes give an error or did it pass silently. In which case: is this a breaking change?

View changes since the review

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.

Yes this PR changes no_core from warn to err, but no_core is unstable so we can do this.
Note that the test has a feature gate.

Note that this PR changes this for all unstable attributes: 887a3f3

Comment thread compiler/rustc_attr_parsing/src/attributes/crate_level.rs
@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 Apr 15, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 15, 2026

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

@JonathanBrouwer
Copy link
Copy Markdown
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 15, 2026
@rust-bors

This comment has been minimized.

@rustbot

This comment has been minimized.

@jdonszelmann
Copy link
Copy Markdown
Contributor

r=me after rebase

@rust-bors

This comment has been minimized.

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 17, 2026

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
Contributor Author

@bors r=jdonszelmann

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 17, 2026

📌 Commit 64a6dd8 has been approved by jdonszelmann

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

Rollup of 5 pull requests

Successful merges:

 - #154781 (Fix attribute order implementation)
 - #155242 (resolve: Introduce `(Local,Extern)Module` newtypes for local and external modules respectively)
 - #149614 (Use `MaybeDangling` in `std`)
 - #153178 (Add `TryFromIntError::kind` method and `IntErrorKind::NotAPowerOfTwo` variant)
 - #155049 (Documenting the case of `Weak::upgrade` returning `None` when the value behind the reference is missing)

Failed merges:

 - #155308 (Make `OnDuplicate::Error` the default for attributes)
rust-bors bot pushed a commit that referenced this pull request Apr 17, 2026
…uwer

Rollup of 5 pull requests

Successful merges:

 - #154781 (Fix attribute order implementation)
 - #155242 (resolve: Introduce `(Local,Extern)Module` newtypes for local and external modules respectively)
 - #149614 (Use `MaybeDangling` in `std`)
 - #153178 (Add `TryFromIntError::kind` method and `IntErrorKind::NotAPowerOfTwo` variant)
 - #155049 (Documenting the case of `Weak::upgrade` returning `None` when the value behind the reference is missing)

Failed merges:

 - #155308 (Make `OnDuplicate::Error` the default for attributes)
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