don't take reachability into account when warning about missing-const-stability

This commit is contained in:
Ralf Jung 2024-08-31 15:06:39 +02:00
parent e3b1966137
commit 3cec2d6935

View File

@ -544,9 +544,8 @@ fn check_missing_const_stability(&self, def_id: LocalDefId, span: Span) {
let is_stable =
self.tcx.lookup_stability(def_id).is_some_and(|stability| stability.level.is_stable());
let missing_const_stability_attribute = self.tcx.lookup_const_stability(def_id).is_none();
let is_reachable = self.effective_visibilities.is_reachable(def_id);
if is_const && is_stable && missing_const_stability_attribute && is_reachable {
if is_const && is_stable && missing_const_stability_attribute {
let descr = self.tcx.def_descr(def_id.to_def_id());
self.tcx.dcx().emit_err(errors::MissingConstStabAttr { span, descr });
}