about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-11-02 21:19:21 +0100
committerRalf Jung <post@ralfj.de>2024-11-10 10:16:26 +0100
commit353f8e13231ad6472b349e34aa201bba814653a7 (patch)
tree9bb094bd1fe909a748803a8eb158041b1dabc857
parentc21c781a4ea9bf05dce550ece2444cc61b5ebce8 (diff)
downloadrust-353f8e13231ad6472b349e34aa201bba814653a7.tar.gz
rust-353f8e13231ad6472b349e34aa201bba814653a7.zip
ensure that all publicly reachable const fn have const stability info
-rw-r--r--clippy_utils/src/qualify_min_const_fn.rs8
1 files changed, 2 insertions, 6 deletions
diff --git a/clippy_utils/src/qualify_min_const_fn.rs b/clippy_utils/src/qualify_min_const_fn.rs
index 666ec8df930..971f8eeb1b3 100644
--- a/clippy_utils/src/qualify_min_const_fn.rs
+++ b/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()
             }
         })
 }