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


impl<S: Stage> NoArgsAttributeParser<S> for NoCoreParser {
const PATH: &[Symbol] = &[sym::no_core];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
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.

yea, I think this is a warn->err regression

View changes since the 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 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
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 15, 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.

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