@@ -380,7 +380,7 @@ fn check_terminator<'tcx>(
380380fn is_stable_const_fn ( tcx : TyCtxt < ' _ > , def_id : DefId , msrv : & Msrv ) -> bool {
381381 tcx. is_const_fn ( def_id)
382382 && tcx. lookup_const_stability ( def_id) . is_none_or ( |const_stab| {
383- if let rustc_attr:: StabilityLevel :: Stable { since, .. } = const_stab. level {
383+ if let rustc_attr:: ConstStabilityLevel :: Stable { since, .. } = const_stab. level {
384384 // Checking MSRV is manually necessary because `rustc` has no such concept. This entire
385385 // function could be removed if `rustc` provided a MSRV-aware version of `is_stable_const_fn`.
386386 // as a part of an unimplemented MSRV check https://github.com/rust-lang/rust/issues/65262.
@@ -393,11 +393,11 @@ fn is_stable_const_fn(tcx: TyCtxt<'_>, def_id: DefId, msrv: &Msrv) -> bool {
393393
394394 msrv. meets ( const_stab_rust_version)
395395 } else {
396- // Unstable const fn, check if the feature is enabled. We need both the regular stability
397- // feature and (if set) the const stability feature to const-call this function.
396+ // Unstable const fn, check if the features are enabled. We need both the regular stability
397+ // features and (if set) the const stability features to const-call this function.
398398 let stab = tcx. lookup_stability ( def_id) ;
399- let is_enabled = stab. is_some_and ( |s| s . is_stable ( ) || tcx. features ( ) . enabled ( s. feature ) )
400- && const_stab . feature . is_none_or ( |f| tcx. features ( ) . enabled ( f ) ) ;
399+ let is_enabled = stab. is_some_and ( |s| tcx. features ( ) . all_enabled ( s. unstable_features ( ) ) )
400+ && tcx. features ( ) . all_enabled ( const_stab . unstable_features ( ) ) ;
401401 is_enabled && msrv. current ( ) . is_none ( )
402402 }
403403 } )
0 commit comments