mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-21 20:23:12 +00:00
ensure that all publicly reachable const fn have const stability info
This commit is contained in:
parent
c21c781a4e
commit
353f8e1323
1 changed files with 2 additions and 6 deletions
|
@ -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()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue