diff options
| author | bors <bors@rust-lang.org> | 2024-10-22 11:02:35 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-10-22 11:02:35 +0000 |
| commit | 78fc7bbfdd775ee6ab3214db69bfabcec764e991 (patch) | |
| tree | 1f76af0457ebd413827d38d047db3afa0291d237 | |
| parent | f03f7c6c9d9320e56355e043e20b0436b0db701a (diff) | |
| parent | 2fd8222bd44d6eea258614b2295125544a6b3612 (diff) | |
| download | rust-78fc7bbfdd775ee6ab3214db69bfabcec764e991.tar.gz rust-78fc7bbfdd775ee6ab3214db69bfabcec764e991.zip | |
Auto merge of #131321 - RalfJung:feature-activation, r=nnethercote
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.
| -rw-r--r-- | clippy_lints/src/manual_div_ceil.rs | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/clippy_lints/src/manual_div_ceil.rs b/clippy_lints/src/manual_div_ceil.rs index 00e02e2a336..4c171e6d890 100644 --- a/clippy_lints/src/manual_div_ceil.rs +++ b/clippy_lints/src/manual_div_ceil.rs @@ -111,11 +111,7 @@ fn check_int_ty_and_feature(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool { let expr_ty = cx.typeck_results().expr_ty(expr); match expr_ty.peel_refs().kind() { ty::Uint(_) => true, - ty::Int(_) => cx - .tcx - .features() - .declared_features - .contains(&Symbol::intern("int_roundings")), + ty::Int(_) => cx.tcx.features().enabled(Symbol::intern("int_roundings")), _ => false, } |
