Skip to content

rustc_feature cleanups - #162051

Merged
rust-bors[bot] merged 9 commits into
rust-lang:mainfrom
nnethercote:rustc_feature-cleanups
Sep 1, 2026
Merged

rustc_feature cleanups#162051
rust-bors[bot] merged 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
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Sep 1, 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 Sep 1, 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 Sep 1, 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 Sep 1, 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 Sep 1, 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 Sep 1, 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 Sep 1, 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 Sep 1, 2026
…uwer

Rollup of 16 pull requests

Successful merges:

 - #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)
 - #160989 (Make sin, cos, exp, exp2, log, log2, log10 generic)
 - #161861 (mir_build: Clarify parts of if-condition lowering)
 - #161929 (explicitly track inherent const generic args kind)
 - #162040 (bootstrap: stage0 to cbae9b4)
 - #162063 (Switch dist-aarch64-linux to EC2 and update dist-x86_64-linux)
 - #161353 (Add test for parallel compiler reproducible build)
 - #161937 (A series of Polonius Alpha refactors)
 - #162051 (`rustc_feature` cleanups)
 - #162055 (remove `_{style}` recovery for diagnostic structs)
 - #162075 (Move track_caller on closures gating to attribute parsing)
 - #162079 (std: implement `File::fsync` for Hermit)
 - #162097 (Deduplicate `InstrumentFnAttr`)
 - #162115 (fix typo in feature documentation)
rust-bors Bot pushed a commit that referenced this pull request Sep 1, 2026
Rollup merge of #162051 - nnethercote:rustc_feature-cleanups, r=JonathanBrouwer

`rustc_feature` cleanups

Various cleanups. Details in individual commits.

r? @JonathanBrouwer
@rust-bors
rust-bors Bot merged commit 8536b9e into rust-lang:main Sep 1, 2026
13 checks passed
@rustbot rustbot added this to the 1.100.0 milestone Sep 1, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Sep 1, 2026
… r=mejrs

Remove `gate_check` from `AttributeStability::Unstable`

Based on the idea from rust-lang#162051 (comment)

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

Remove `gate_check` from `AttributeStability::Unstable`

Based on the idea from rust-lang#162051 (comment)

r? @mejrs
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (9aa1b10): comparison URL.

Overall result: ❌ regressions - please read:

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

@bors rollup=never rustc-perf
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.4% [0.3%, 0.6%] 21
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.4% [-0.4%, -0.4%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

This perf run didn't have relevant results for this metric.

Cycles

This perf run didn't have relevant results for this metric.

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: missing data
Artifact size: 400.59 MiB -> 400.55 MiB (-0.01%)

@rustbot rustbot added the perf-regression Performance regression. label Sep 1, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Sep 1, 2026
… r=mejrs

Remove `gate_check` from `AttributeStability::Unstable`

Based on the idea from rust-lang#162051 (comment)

r? @mejrs
@JonathanBrouwer

JonathanBrouwer commented Sep 1, 2026

Copy link
Copy Markdown
Member

Huh, I wonder what caused the regression here?

@nnethercote
nnethercote deleted the rustc_feature-cleanups branch September 1, 2026 21:27
rust-bors Bot pushed a commit that referenced this pull request Sep 1, 2026
Rollup merge of #162086 - JonathanBrouwer:remove_gate_check, r=mejrs

Remove `gate_check` from `AttributeStability::Unstable`

Based on the idea from #162051 (comment)

r? @mejrs
@nnethercote

Copy link
Copy Markdown
Contributor Author
  • This PR contains only very minor refactorings that you wouldn't expect to affect perf.
  • I can't reproduce the regression when I build locally.
  • I can reproduce the regression from the downloaded CI artifacts. A Cachegrind diff shows it's entirely in parse_expr_assoc_after_attrs, which this PR doesn't touch.
  • The icount regressions are tiny and mostly affect deep-vector, which is a parsing stress test. tuple-stress and ucd also show up, and they are also parsing stress tests.

All of this strongly suggests this is just PGO/BOLT Brownian motion. I did one experiment in #162163 that didn't find anything of note; I don't think it's worth doing more.

pull Bot pushed a commit to LeeeeeeM/miri that referenced this pull request Sep 2, 2026
…uwer

Rollup of 16 pull requests

Successful merges:

 - rust-lang/rust#137720 (support `#[target_feature(enable = ...)]` on `#[naked]` functions)
 - rust-lang/rust#160534 (stabilize smart pointer map functions)
 - rust-lang/rust#160551 (mir_build: Clearly distinguish or/refutable/irrefutable patterns during match lowering)
 - rust-lang/rust#160989 (Make sin, cos, exp, exp2, log, log2, log10 generic)
 - rust-lang/rust#161861 (mir_build: Clarify parts of if-condition lowering)
 - rust-lang/rust#161929 (explicitly track inherent const generic args kind)
 - rust-lang/rust#162040 (bootstrap: stage0 to cbae9b4cae2b108f6a3d18cfe6075714bb739463)
 - rust-lang/rust#162063 (Switch dist-aarch64-linux to EC2 and update dist-x86_64-linux)
 - rust-lang/rust#161353 (Add test for parallel compiler reproducible build)
 - rust-lang/rust#161937 (A series of Polonius Alpha refactors)
 - rust-lang/rust#162051 (`rustc_feature` cleanups)
 - rust-lang/rust#162055 (remove `_{style}` recovery for diagnostic structs)
 - rust-lang/rust#162075 (Move track_caller on closures gating to attribute parsing)
 - rust-lang/rust#162079 (std: implement `File::fsync` for Hermit)
 - rust-lang/rust#162097 (Deduplicate `InstrumentFnAttr`)
 - rust-lang/rust#162115 (fix typo in feature documentation)
asukaminato0721 pushed a commit to asukaminato0721/rust-analyzer that referenced this pull request Sep 2, 2026
…uwer

Rollup of 16 pull requests

Successful merges:

 - rust-lang/rust#137720 (support `#[target_feature(enable = ...)]` on `#[naked]` functions)
 - rust-lang/rust#160534 (stabilize smart pointer map functions)
 - rust-lang/rust#160551 (mir_build: Clearly distinguish or/refutable/irrefutable patterns during match lowering)
 - rust-lang/rust#160989 (Make sin, cos, exp, exp2, log, log2, log10 generic)
 - rust-lang/rust#161861 (mir_build: Clarify parts of if-condition lowering)
 - rust-lang/rust#161929 (explicitly track inherent const generic args kind)
 - rust-lang/rust#162040 (bootstrap: stage0 to cbae9b4cae2b108f6a3d18cfe6075714bb739463)
 - rust-lang/rust#162063 (Switch dist-aarch64-linux to EC2 and update dist-x86_64-linux)
 - rust-lang/rust#161353 (Add test for parallel compiler reproducible build)
 - rust-lang/rust#161937 (A series of Polonius Alpha refactors)
 - rust-lang/rust#162051 (`rustc_feature` cleanups)
 - rust-lang/rust#162055 (remove `_{style}` recovery for diagnostic structs)
 - rust-lang/rust#162075 (Move track_caller on closures gating to attribute parsing)
 - rust-lang/rust#162079 (std: implement `File::fsync` for Hermit)
 - rust-lang/rust#162097 (Deduplicate `InstrumentFnAttr`)
 - rust-lang/rust#162115 (fix typo in feature documentation)
github-actions Bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Sep 4, 2026
…uwer

Rollup of 16 pull requests

Successful merges:

 - rust-lang/rust#137720 (support `#[target_feature(enable = ...)]` on `#[naked]` functions)
 - rust-lang/rust#160534 (stabilize smart pointer map functions)
 - rust-lang/rust#160551 (mir_build: Clearly distinguish or/refutable/irrefutable patterns during match lowering)
 - rust-lang/rust#160989 (Make sin, cos, exp, exp2, log, log2, log10 generic)
 - rust-lang/rust#161861 (mir_build: Clarify parts of if-condition lowering)
 - rust-lang/rust#161929 (explicitly track inherent const generic args kind)
 - rust-lang/rust#162040 (bootstrap: stage0 to cbae9b4cae2b108f6a3d18cfe6075714bb739463)
 - rust-lang/rust#162063 (Switch dist-aarch64-linux to EC2 and update dist-x86_64-linux)
 - rust-lang/rust#161353 (Add test for parallel compiler reproducible build)
 - rust-lang/rust#161937 (A series of Polonius Alpha refactors)
 - rust-lang/rust#162051 (`rustc_feature` cleanups)
 - rust-lang/rust#162055 (remove `_{style}` recovery for diagnostic structs)
 - rust-lang/rust#162075 (Move track_caller on closures gating to attribute parsing)
 - rust-lang/rust#162079 (std: implement `File::fsync` for Hermit)
 - rust-lang/rust#162097 (Deduplicate `InstrumentFnAttr`)
 - rust-lang/rust#162115 (fix typo in feature documentation)
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 perf-regression Performance regression. 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