@@ -380,7 +380,7 @@ fn check_terminator<'tcx>(
380
380
fn is_stable_const_fn ( tcx : TyCtxt < ' _ > , def_id : DefId , msrv : & Msrv ) -> bool {
381
381
tcx. is_const_fn ( def_id)
382
382
&& 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 {
384
384
// Checking MSRV is manually necessary because `rustc` has no such concept. This entire
385
385
// function could be removed if `rustc` provided a MSRV-aware version of `is_stable_const_fn`.
386
386
// 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 {
393
393
394
394
msrv. meets ( const_stab_rust_version)
395
395
} 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.
398
398
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 ( ) ) ;
401
401
is_enabled && msrv. current ( ) . is_none ( )
402
402
}
403
403
} )
0 commit comments