diff options
| author | Ralf Jung <post@ralfj.de> | 2024-11-02 21:19:21 +0100 | 
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2024-11-10 10:16:26 +0100 | 
| commit | e96808162ad7ff5906d7b58d32a25abe139e998c (patch) | |
| tree | 039f785ca0af8ef506a8b07eac1e1e822ada4917 /src | |
| parent | 686eeb83e9c6d7f70848cdf84f490f5c1aa3edd3 (diff) | |
| download | rust-e96808162ad7ff5906d7b58d32a25abe139e998c.tar.gz rust-e96808162ad7ff5906d7b58d32a25abe139e998c.zip | |
ensure that all publicly reachable const fn have const stability info
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/html/render/mod.rs | 4 | ||||
| -rw-r--r-- | src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs | 8 | 
2 files changed, 3 insertions, 9 deletions
| diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 8446235fb18..ce96d1d0a95 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -1010,9 +1010,7 @@ fn render_stability_since_raw_with_extra( // don't display const unstable if entirely unstable None } else { - let unstable = if let Some(n) = issue - && let Some(feature) = feature - { + let unstable = if let Some(n) = issue { format!( "<a \ href=\"https://github.com/rust-lang/rust/issues/{n}\" \ diff --git a/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs b/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs index 666ec8df930..971f8eeb1b3 100644 --- a/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs +++ b/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs @@ -393,12 +393,8 @@ fn is_stable_const_fn(tcx: TyCtxt<'_>, def_id: DefId, msrv: &Msrv) -> bool { msrv.meets(const_stab_rust_version) } else { - // Unstable const fn, check if the feature is enabled. We need both the regular stability - // feature and (if set) the const stability feature to const-call this function. - let stab = tcx.lookup_stability(def_id); - let is_enabled = stab.is_some_and(|s| s.is_stable() || tcx.features().enabled(s.feature)) - && const_stab.feature.is_none_or(|f| tcx.features().enabled(f)); - is_enabled && msrv.current().is_none() + // Unstable const fn, check if the feature is enabled. + tcx.features().enabled(const_stab.feature) && msrv.current().is_none() } }) } | 
