Skip to content

rustc_feature cleanups - #162051

Open
nnethercote wants to merge 9 commits into
rust-lang:mainfrom
nnethercote:rustc_feature-cleanups
Open

rustc_feature cleanups#162051
nnethercote wants to merge 9 commits into
rust-lang:mainfrom
nnethercote:rustc_feature-cleanups

Conversation

@nnethercote

Copy link
Copy Markdown
Contributor

Various cleanups. Details in individual commits.

r? @JonathanBrouwer

Rename it `BUILTIN_ATTRIBUTE_SET` because it's a set, and use `contains`
instead of `get` where appropriate.
Also fix a typo and wrap some overlong comment lines.
Fix typos, wrap overlong lines, add missing comments, etc.
Avoid mixing it with `NonZeroU32`.
Every caller passes a predicate that just does a name comparison.
@rustbot

rustbot commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann, @JonathanBrouwer

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

cc @jdonszelmann, @JonathanBrouwer

rustc-dev-guide is developed in its own repository. If possible, consider making this change to rust-lang/rustc-dev-guide instead.

cc @BoxyUwU, @tshepang

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-rustc-dev-guide Area: rustc-dev-guide 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 Aug 31, 2026
@nnethercote

Copy link
Copy Markdown
Contributor Author

LLM disclosure: these changes were mostly identified by an LLM. I did all the code and text changes myself.

/// Notes to be displayed when an attempt is made to use the attribute without its feature gate.
/// Check function to be called during the `PostExpansionVisitor` pass, which will be one
/// of the `Features::*` functions
gate_check: GateFn,

@mejrs mejrs Aug 31, 2026

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.

FWIW this field only really exists to statically check that the feature actually exists - Features::doesnt_exist can't be found because that's not a feature.

You could remove this field if you can do that check in another way.

View changes since the review

@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.

[dependencies]
# tidy-alphabetical-start
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_macros = { path = "../rustc_macros" }

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.

This new dependency already existed transitively through rustc_data_structures so is fine :)

@rust-bors

rust-bors Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 60be562 has been approved by JonathanBrouwer

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

`rustc_feature` cleanups

Various cleanups. Details in individual commits.

r? @JonathanBrouwer
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Aug 31, 2026
…, r=JonathanBrouwer

`rustc_feature` cleanups

Various cleanups. Details in individual commits.

r? @JonathanBrouwer
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 31, 2026
…, r=JonathanBrouwer

`rustc_feature` cleanups

Various cleanups. Details in individual commits.

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

Rollup of 12 pull requests

Successful merges:

 - #162045 (`rust-analyzer` subtree update)
 - #162077 (compiler-builtins subtree update)
 - #137720 (support `#[target_feature(enable = ...)]` on `#[naked]` functions)
 - #160534 (stabilize smart pointer map functions)
 - #160551 (mir_build: Clearly distinguish or/refutable/irrefutable patterns during match lowering)
 - #161929 (explicitly track inherent const generic args kind)
 - #162063 (Switch dist-aarch64-linux to EC2 and update dist-x86_64-linux)
 - #161937 (A series of Polonius Alpha refactors)
 - #162014 (Move more `rustdoc-html` tests using `--test` into the right folder)
 - #162051 (`rustc_feature` cleanups)
 - #162055 (remove `_{style}` recovery for diagnostic structs)
 - #162075 (Move track_caller on closures gating to attribute parsing)
jhpratt added a commit to jhpratt/rust that referenced this pull request Sep 1, 2026
…, r=JonathanBrouwer

`rustc_feature` cleanups

Various cleanups. Details in individual commits.

r? @JonathanBrouwer
jhpratt added a commit to jhpratt/rust that referenced this pull request Sep 1, 2026
…, r=JonathanBrouwer

`rustc_feature` cleanups

Various cleanups. Details in individual commits.

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 (`#[…]`, `#![…]`) A-rustc-dev-guide Area: rustc-dev-guide 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.

4 participants