@@ -334,9 +334,12 @@ impl<'tcx> MissingStabilityAnnotations<'tcx> {
334334
335335 macro_rules! find_attr_span {
336336 ( $name: ident) => { {
337- let attrs = self . tcx. hir_attrs( self . tcx. local_def_id_to_hir_id( def_id) ) ;
337+ find_attr_span!( $name, def_id)
338+ } } ;
339+ ( $name: ident, $id: expr) => { {
340+ let attrs = self . tcx. hir_attrs( self . tcx. local_def_id_to_hir_id( $id) ) ;
338341 find_attr!( attrs, AttributeKind :: $name { span, .. } => * span)
339- } }
342+ } } ;
340343 }
341344
342345 if stab. is_none ( )
@@ -398,6 +401,16 @@ impl<'tcx> MissingStabilityAnnotations<'tcx> {
398401 self . tcx . dcx ( ) . emit_err ( errors:: MissingConstErr { fn_sig_span : fn_sig. span } ) ;
399402 }
400403
404+ if let DefKind :: InlineConst = self . tcx . def_kind ( def_id)
405+ && const_stab. is_some ( )
406+ && let parent = self . tcx . local_parent ( def_id)
407+ && self . tcx . lookup_const_stability ( parent) != const_stab
408+ && let Some ( span) = find_attr_span ! ( ConstStability )
409+ {
410+ let parent_span = find_attr_span ! ( ConstStability , parent) ;
411+ self . tcx . dcx ( ) . emit_err ( errors:: UnstableInlineConstInConst { span, parent_span } ) ;
412+ }
413+
401414 // If this is marked const *stable*, it must also be regular-stable.
402415 if let Some ( const_stab) = const_stab
403416 && let Some ( fn_sig) = fn_sig
@@ -478,6 +491,11 @@ impl<'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'tcx> {
478491 intravisit:: walk_item ( self , i)
479492 }
480493
494+ fn visit_inline_const ( & mut self , c : & ' tcx rustc_hir:: ConstBlock ) -> Self :: Result {
495+ self . check_compatible_stability ( c. def_id ) ;
496+ intravisit:: walk_inline_const ( self , c)
497+ }
498+
481499 fn visit_trait_item ( & mut self , ti : & ' tcx hir:: TraitItem < ' tcx > ) {
482500 self . check_compatible_stability ( ti. owner_id . def_id ) ;
483501 self . check_missing_stability ( ti. owner_id . def_id ) ;
@@ -601,7 +619,6 @@ impl<'tcx> Visitor<'tcx> for Checker<'tcx> {
601619 let attrs = self . tcx . hir_attrs ( item. hir_id ( ) ) ;
602620 let stab = find_attr ! ( attrs, AttributeKind :: Stability { stability, span} => ( * stability, * span) ) ;
603621
604- // FIXME(jdonszelmann): make it impossible to miss the or_else in the typesystem
605622 let const_stab = find_attr ! ( attrs, AttributeKind :: ConstStability { stability, ..} => * stability) ;
606623
607624 let unstable_feature_stab =
0 commit comments