Skip to content

Add #![unstable_removed(..)] attribute to track removed features#153335

Open
Ozzy1423 wants to merge 2 commits intorust-lang:mainfrom
Ozzy1423:removed-features
Open

Add #![unstable_removed(..)] attribute to track removed features#153335
Ozzy1423 wants to merge 2 commits intorust-lang:mainfrom
Ozzy1423:removed-features

Conversation

@Ozzy1423
Copy link
Contributor

@Ozzy1423 Ozzy1423 commented Mar 3, 2026

Adds the #![unstable_removed(..)] attribute to enable tracking removed library features.
Produce an error when a removed attribute is used.
Add a test that it works.

For #141617

I will go through and add the removed features in another commit, just wanted to post this for a review of the code.

TODO:
Find out the list of removed features and add them
Which file should I add them to?

r? @jyn514

@rustbot
Copy link
Collaborator

rustbot commented Mar 3, 2026

Some changes occurred in compiler/rustc_passes/src/check_attr.rs

cc @jdonszelmann, @JonathanBrouwer

Some changes occurred in compiler/rustc_hir/src/attrs

cc @jdonszelmann, @JonathanBrouwer

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann, @JonathanBrouwer

@rustbot
Copy link
Collaborator

rustbot commented Mar 3, 2026

Failed to set assignee to jyn514: invalid assignee

Note: Only org members with at least the repository "read" role, users with write permissions, or people who have commented on the PR may be assigned.

@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. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Mar 3, 2026
Copy link
Member

@jyn514 jyn514 left a comment

Choose a reason for hiding this comment

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

neat! can you add one or two examples of real features that were removed so i can see what it looks like?

this looks fine to me from a compiler side, i'd love to have someone from @rust-lang/libs review though.

View changes since this review

Copy link
Contributor

@jdonszelmann jdonszelmann left a comment

Choose a reason for hiding this comment

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

this is the one thing I'd like to see

View changes since this review

let word = param.path().word();
match word.map(|i| i.name) {
Some(sym::feature) => {
insert_value_into_option_or_error(cx, &param, &mut feature, word.unwrap())?
Copy link
Contributor

Choose a reason for hiding this comment

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

you can avoid these unwraps using Some(word@sym::...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

couldn't get word@sym to work (word was then the wrong type for the insert_value... function) so just added an explicit check

@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 Mar 3, 2026
@rustbot
Copy link
Collaborator

rustbot commented Mar 3, 2026

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

@rustbot
Copy link
Collaborator

rustbot commented Mar 6, 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.

@Ozzy1423
Copy link
Contributor Author

Ozzy1423 commented Mar 7, 2026

I've now provided an example, moving the concat_idents feature removal tracking to the new attribute in the second commit.
@rustbot ready
Unsure where you would like these unstable_removed attributes to live. (At their old impl site? All in one place?)

@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 Mar 7, 2026
@jdonszelmann
Copy link
Contributor

jdonszelmann commented Mar 9, 2026

r=me on behalf of compiler after @nia-e brings it up with T-libs on wednesday. Ping me if you need the r+

@jdonszelmann jdonszelmann added the I-libs-nominated Nominated for discussion during a libs team meeting. label Mar 9, 2026
@nia-e
Copy link
Member

nia-e commented Mar 9, 2026

It would be worth checking if there's any in-tree dev docs on (removing) unstable features and updating them to mention this also

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) I-libs-nominated Nominated for discussion during a libs team meeting. 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. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants