@@ -74,16 +74,16 @@ enum ConstKind {
7474}
7575
7676impl ConstKind {
77- fn for_body ( body : & hir:: Body < ' _ > , hir_map : Map < ' _ > ) -> Option < Self > {
78- let is_const_fn = |id| hir_map. fn_sig_by_hir_id ( id) . unwrap ( ) . header . is_const ( ) ;
79-
80- let owner = hir_map. body_owner ( body. id ( ) ) ;
81- let const_kind = match hir_map. body_owner_kind ( owner) {
77+ fn for_body ( body : & hir:: Body < ' _ > , tcx : TyCtxt < ' _ > ) -> Option < Self > {
78+ let owner = tcx. hir ( ) . body_owner ( body. id ( ) ) ;
79+ let const_kind = match tcx. hir ( ) . body_owner_kind ( owner) {
8280 hir:: BodyOwnerKind :: Const => Self :: Const ,
8381 hir:: BodyOwnerKind :: Static ( Mutability :: Mut ) => Self :: StaticMut ,
8482 hir:: BodyOwnerKind :: Static ( Mutability :: Not ) => Self :: Static ,
8583
86- hir:: BodyOwnerKind :: Fn if is_const_fn ( owner) => Self :: ConstFn ,
84+ hir:: BodyOwnerKind :: Fn if tcx. is_const_fn_raw ( tcx. hir ( ) . local_def_id ( owner) ) => {
85+ Self :: ConstFn
86+ }
8787 hir:: BodyOwnerKind :: Fn | hir:: BodyOwnerKind :: Closure => return None ,
8888 } ;
8989
@@ -211,7 +211,7 @@ impl<'tcx> Visitor<'tcx> for CheckConstVisitor<'tcx> {
211211 }
212212
213213 fn visit_body ( & mut self , body : & ' tcx hir:: Body < ' tcx > ) {
214- let kind = ConstKind :: for_body ( body, self . tcx . hir ( ) ) ;
214+ let kind = ConstKind :: for_body ( body, self . tcx ) ;
215215 self . recurse_into ( kind, |this| intravisit:: walk_body ( this, body) ) ;
216216 }
217217
0 commit comments