1
Fork 0

don't require const stability for const impls

This commit is contained in:
Deadbeef 2024-11-20 17:04:05 +08:00
parent bcfea1f8d2
commit 030ddeecab
3 changed files with 3 additions and 21 deletions

View file

@ -590,16 +590,7 @@ impl<'tcx> MissingStabilityAnnotations<'tcx> {
}
fn check_missing_const_stability(&self, def_id: LocalDefId, span: Span) {
// if the const impl is derived using the `derive_const` attribute,
// then it would be "stable" at least for the impl.
// We gate usages of it using `feature(const_trait_impl)` anyways
// so there is no unstable leakage
if self.tcx.is_automatically_derived(def_id.to_def_id()) {
return;
}
let is_const = self.tcx.is_const_fn(def_id.to_def_id())
|| self.tcx.is_const_trait_impl(def_id.to_def_id());
let is_const = self.tcx.is_const_fn(def_id.to_def_id());
// Reachable const fn must have a stability attribute.
if is_const