@@ -12,9 +12,9 @@ use rustc_hir::def::{DefKind, Res};
1212use rustc_hir:: def_id:: { CRATE_DEF_ID , LOCAL_CRATE , LocalDefId , LocalModDefId } ;
1313use rustc_hir:: intravisit:: { self , Visitor , VisitorExt } ;
1414use rustc_hir:: {
15- self as hir, AmbigArg , ConstStability , DefaultBodyStability , FieldDef , HirId , Item , ItemKind ,
16- Path , Stability , StabilityLevel , StableSince , TraitRef , Ty , TyKind , UnstableReason , UsePath ,
17- VERSION_PLACEHOLDER , Variant , find_attr,
15+ self as hir, AmbigArg , ConstStability , Constness , DefaultBodyStability , FieldDef , HirId , Item ,
16+ ItemKind , Path , Stability , StabilityLevel , StableSince , TraitRef , Ty , TyKind , UnstableReason ,
17+ UsePath , VERSION_PLACEHOLDER , Variant , find_attr,
1818} ;
1919use rustc_middle:: hir:: nested_filter;
2020use rustc_middle:: middle:: lib_features:: { FeatureStability , LibFeatures } ;
@@ -207,7 +207,7 @@ fn lookup_const_stability(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<ConstSt
207207 let parent_stab = tcx. lookup_stability ( parent) ?;
208208 if parent_stab. is_unstable ( )
209209 && let Some ( fn_sig) = tcx. hir_node_by_def_id ( def_id) . fn_sig ( )
210- && fn_sig. header . is_const ( )
210+ && matches ! ( fn_sig. header. constness , Constness :: Const { .. } )
211211 {
212212 let const_stable_indirect = find_attr ! ( tcx, def_id, RustcConstStableIndirect ) ;
213213 return Some ( ConstStability :: unmarked ( const_stable_indirect, parent_stab) ) ;
@@ -229,7 +229,7 @@ fn lookup_const_stability(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<ConstSt
229229 // If this is a const fn but not annotated with stability markers, see if we can inherit
230230 // regular stability.
231231 if let Some ( fn_sig) = tcx. hir_node_by_def_id ( def_id) . fn_sig ( )
232- && fn_sig. header . is_const ( )
232+ && matches ! ( fn_sig. header. constness , Constness :: Const { .. } )
233233 && const_stab. is_none ( )
234234 // We only ever inherit unstable features.
235235 && let Some ( inherit_regular_stab) = tcx. lookup_stability ( def_id)
@@ -385,7 +385,7 @@ impl<'tcx> MissingStabilityAnnotations<'tcx> {
385385 // implied), check if the function/method is const or the parent impl block is const.
386386 let fn_sig = self . tcx . hir_node_by_def_id ( def_id) . fn_sig ( ) ;
387387 if let Some ( fn_sig) = fn_sig
388- && !fn_sig. header . is_const ( )
388+ && !matches ! ( fn_sig. header. constness , Constness :: Const { .. } )
389389 && const_stab. is_some ( )
390390 && find_attr_span ! ( RustcConstStability ) . is_some ( )
391391 {
0 commit comments