-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
terminology: #[feature] *enables* a feature (instead of "declaring" or "activating" it) #131321
Conversation
r? @nnethercote rustbot has assigned @nnethercote. Use |
This comment has been minimized.
This comment has been minimized.
8c5bf45
to
2c37795
Compare
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
This comment has been minimized.
This comment has been minimized.
2c37795
to
1df170c
Compare
This is an improvement over "declared", but I was going to suggest enable/enabled over activate/active. Several of the existing comments already used enable/enabled. |
Hm... both "active" and "enabled" are used then, it seems. @rust-lang/compiler any preference? @bors r- |
If you're looking to make comments use consistent terminology too, the doc comments in rustc_middle/src/middle/stability.rs use yet another term: features being "provided". |
It's not a perfect analogy, but cargo features are "enabled". |
Thinking about it, I think I like "enabled" more.
|
1df170c
to
3b7ed10
Compare
These commits modify compiler targets. |
I now updated this to "enabling" a feature. @rustbot ready |
Finished benchmarking commit (ded5475): comparison URL. Overall result: ❌ regressions - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (secondary -0.2%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 775.847s -> 775.025s (-0.11%) |
Oh wow, it basically makes no difference. That's surprising. I guess the hash set is usually empty and so checking it is pretty fast, or so? I can still bring back the |
@nnethercote ehuss is not on the compiler team, so it seems odd to ask them for review here? This is basically entirely an internal compiler change. The term shows up in one error message, but it's not like we super carefully review those. |
Yea, I have nothing to say here (other than the perf experiment commit will likely cause a lot of conflicts for other PRs). I'll reassign to the original reviewer. r? @est31 |
|
||
self.all_features()[..].hash_stable(hcx, hasher); | ||
self.all_lang_features()[..].hash_stable(hcx, hasher); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the change from all_features
to all_lang_features
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, you renamed the function above.
Ok, r=me for the first two commits. I like the idea of the third one -- good to avoid duplicating the data -- but I think it's worth putting that in a separate PR because it touches so many lines. |
Okay I will move 6c38ef0 to a separate PR. |
…r "activating" it)
… debug assertions
6c38ef0
to
1381773
Compare
@bors r=nnethercote |
☀️ Test successful - checks-actions |
Finished benchmarking commit (bca5fde): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (secondary -3.1%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 780.605s -> 781.36s (0.10%) |
…=<try> nightly feature tracking: get rid of the per-feature bool fields The `struct Features` that tracks which features are enabled has a ton of public `bool`-typed fields that are basically caching the result of looking up the corresponding feature in `enabled_lang_features`. Having public fields with an invariant is not great, so at least they should be made private. However, it turns out caching these lookups is actually [not worth it](rust-lang#131321 (comment)), so this PR just entirely gets rid of these fields. (The alternative would be to make them private and have a method for each of them to expose them in a read-only way. Most of the diff of this PR would be the same in that case.) r? `@nnethercote`
…=nnethercote nightly feature tracking: get rid of the per-feature bool fields The `struct Features` that tracks which features are enabled has a ton of public `bool`-typed fields that are basically caching the result of looking up the corresponding feature in `enabled_lang_features`. Having public fields with an invariant is not great, so at least they should be made private. However, it turns out caching these lookups is actually [not worth it](rust-lang#131321 (comment)), so this PR just entirely gets rid of these fields. (The alternative would be to make them private and have a method for each of them to expose them in a read-only way. Most of the diff of this PR would be the same in that case.) r? `@nnethercote`
…ercote terminology: #[feature] *enables* a feature (instead of "declaring" or "activating" it) Mostly, we currently call a feature that has a corresponding `#[feature(name)]` attribute in the current crate a "declared" feature. I think that is confusing as it does not align with what "declaring" usually means. Furthermore, we *also* refer to `#[stable]`/`#[unstable]` as *declaring* a feature (e.g. in [these diagnostics](https://github.com/rust-lang/rust/blob/f25e5abea229a6b6aa77b45e21cb784e785c6040/compiler/rustc_passes/messages.ftl#L297-L301)), which aligns better with what "declaring" usually means. To make things worse, the functions `tcx.features().active(...)` and `tcx.features().declared(...)` both exist and they are doing almost the same thing (testing whether a corresponding `#[feature(name)]` exists) except that `active` would ICE if the feature is not an unstable lang feature. On top of this, the callback when a feature is activated/declared is called `set_enabled`, and many comments also talk about "enabling" a feature. So really, our terminology is just a mess. I would suggest we use "declaring a feature" for saying that something is/was guarded by a feature (e.g. `#[stable]`/`#[unstable]`), and "enabling a feature" for `#[feature(name)]`. This PR implements that.
Mostly, we currently call a feature that has a corresponding
#[feature(name)]
attribute in the current crate a "declared" feature. I think that is confusing as it does not align with what "declaring" usually means. Furthermore, we also refer to#[stable]
/#[unstable]
as declaring a feature (e.g. in these diagnostics), which aligns better with what "declaring" usually means. To make things worse, the functionstcx.features().active(...)
andtcx.features().declared(...)
both exist and they are doing almost the same thing (testing whether a corresponding#[feature(name)]
exists) except thatactive
would ICE if the feature is not an unstable lang feature. On top of this, the callback when a feature is activated/declared is calledset_enabled
, and many comments also talk about "enabling" a feature.So really, our terminology is just a mess.
I would suggest we use "declaring a feature" for saying that something is/was guarded by a feature (e.g.
#[stable]
/#[unstable]
), and "enabling a feature" for#[feature(name)]
. This PR implements that.