Skip to content

Commit 86512cb

Browse files
committed
passes: propagate unstability for traits
Unstability is propagated when staged API is not used and `-Zforce-unstable-if-unmarked` is, but this only happened for const functions not const traits, which ends up being an issue for some of the minicore tests of codegen backends when introducing the sizedness traits.
1 parent 0f77655 commit 86512cb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

compiler/rustc_passes/src/stability.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,10 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
155155
if let Some(stab) = self.parent_stab {
156156
if inherit_deprecation.yes() && stab.is_unstable() {
157157
self.index.stab_map.insert(def_id, stab);
158-
if fn_sig.is_some_and(|s| s.header.is_const()) {
158+
let is_const = fn_sig.is_some_and(|s| s.header.is_const())
159+
|| (self.tcx.def_kind(def_id) == DefKind::Trait
160+
&& self.tcx.is_const_trait(def_id.to_def_id()));
161+
if is_const {
159162
self.index.const_stab_map.insert(
160163
def_id,
161164
ConstStability::unmarked(const_stability_indirect, stab),

0 commit comments

Comments
 (0)