File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
compiler/rustc_middle/src Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -310,7 +310,7 @@ impl<'tcx> TyCtxt<'tcx> {
310310 /// This should only be used for determining the context of a body, a return
311311 /// value of `Some` does not always suggest that the owner of the body is `const`,
312312 /// just that it has to be checked as if it were.
313- pub fn hir_body_const_context ( self , def_id : impl Into < DefId > ) -> Option < ConstContext > {
313+ pub fn hir_body_const_context ( self , def_id : LocalDefId ) -> Option < ConstContext > {
314314 let def_id = def_id. into ( ) ;
315315 let ccx = match self . hir_body_owner_kind ( def_id) {
316316 BodyOwnerKind :: Const { inline } => ConstContext :: Const { inline } ,
Original file line number Diff line number Diff line change @@ -1624,7 +1624,11 @@ pub fn write_allocations<'tcx>(
16241624 Some ( GlobalAlloc :: Static ( did) ) if !tcx. is_foreign_item ( did) => {
16251625 write ! ( w, " (static: {}" , tcx. def_path_str( did) ) ?;
16261626 if body. phase <= MirPhase :: Runtime ( RuntimePhase :: PostCleanup )
1627- && tcx. hir_body_const_context ( body. source . def_id ( ) ) . is_some ( )
1627+ && body
1628+ . source
1629+ . def_id ( )
1630+ . as_local ( )
1631+ . is_some_and ( |def_id| tcx. hir_body_const_context ( def_id) . is_some ( ) )
16281632 {
16291633 // Statics may be cyclic and evaluating them too early
16301634 // in the MIR pipeline may cause cycle errors even though
You can’t perform that action at this time.
0 commit comments