rustc_feature cleanups - #162051
Conversation
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.
It's more idiomatic.
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.
|
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. 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
|
|
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, |
There was a problem hiding this comment.
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.
| [dependencies] | ||
| # tidy-alphabetical-start | ||
| rustc_data_structures = { path = "../rustc_data_structures" } | ||
| rustc_macros = { path = "../rustc_macros" } |
There was a problem hiding this comment.
This new dependency already existed transitively through rustc_data_structures so is fine :)
…, r=JonathanBrouwer `rustc_feature` cleanups Various cleanups. Details in individual commits. r? @JonathanBrouwer
…, r=JonathanBrouwer `rustc_feature` cleanups Various cleanups. Details in individual commits. r? @JonathanBrouwer
…, r=JonathanBrouwer `rustc_feature` cleanups Various cleanups. Details in individual commits. r? @JonathanBrouwer
…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)
…, r=JonathanBrouwer `rustc_feature` cleanups Various cleanups. Details in individual commits. r? @JonathanBrouwer
…, r=JonathanBrouwer `rustc_feature` cleanups Various cleanups. Details in individual commits. r? @JonathanBrouwer
…, r=JonathanBrouwer `rustc_feature` cleanups Various cleanups. Details in individual commits. r? @JonathanBrouwer
…, r=JonathanBrouwer `rustc_feature` cleanups Various cleanups. Details in individual commits. r? @JonathanBrouwer
…, r=JonathanBrouwer `rustc_feature` cleanups Various cleanups. Details in individual commits. r? @JonathanBrouwer
…, r=JonathanBrouwer `rustc_feature` cleanups Various cleanups. Details in individual commits. r? @JonathanBrouwer
…, r=JonathanBrouwer `rustc_feature` cleanups Various cleanups. Details in individual commits. r? @JonathanBrouwer
…, r=JonathanBrouwer `rustc_feature` cleanups Various cleanups. Details in individual commits. r? @JonathanBrouwer
…, r=JonathanBrouwer `rustc_feature` cleanups Various cleanups. Details in individual commits. r? @JonathanBrouwer
…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)
Rollup merge of #162051 - nnethercote:rustc_feature-cleanups, r=JonathanBrouwer `rustc_feature` cleanups Various cleanups. Details in individual commits. r? @JonathanBrouwer
… r=mejrs Remove `gate_check` from `AttributeStability::Unstable` Based on the idea from rust-lang#162051 (comment) r? @mejrs
… r=mejrs Remove `gate_check` from `AttributeStability::Unstable` Based on the idea from rust-lang#162051 (comment) r? @mejrs
|
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 @bors rollup=never rustc-perf Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)This perf run didn't have relevant results for this metric. CyclesThis perf run didn't have relevant results for this metric. Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: missing data |
… r=mejrs Remove `gate_check` from `AttributeStability::Unstable` Based on the idea from rust-lang#162051 (comment) r? @mejrs
|
Huh, I wonder what caused the regression here? |
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
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. |
…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)
…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)
…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)
Various cleanups. Details in individual commits.
r? @JonathanBrouwer