Skip to content

Commit

Permalink
passes: propagate unstability for traits
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
davidtwco committed Mar 11, 2025
1 parent 6622800 commit 7cd1fa7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion compiler/rustc_passes/src/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,10 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
if let Some(stab) = self.parent_stab {
if inherit_deprecation.yes() && stab.is_unstable() {
self.index.stab_map.insert(def_id, stab);
if fn_sig.is_some_and(|s| s.header.is_const()) {
let is_const = fn_sig.is_some_and(|s| s.header.is_const())
|| (self.tcx.def_kind(def_id) == DefKind::Trait
&& self.tcx.is_const_trait(def_id.to_def_id()));
if is_const {
self.index.const_stab_map.insert(
def_id,
ConstStability::unmarked(const_stability_indirect, stab),
Expand Down

0 comments on commit 7cd1fa7

Please sign in to comment.