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> {
310
310
/// This should only be used for determining the context of a body, a return
311
311
/// value of `Some` does not always suggest that the owner of the body is `const`,
312
312
/// 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 > {
314
314
let def_id = def_id. into ( ) ;
315
315
let ccx = match self . hir_body_owner_kind ( def_id) {
316
316
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>(
1624
1624
Some ( GlobalAlloc :: Static ( did) ) if !tcx. is_foreign_item ( did) => {
1625
1625
write ! ( w, " (static: {}" , tcx. def_path_str( did) ) ?;
1626
1626
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 ( ) )
1628
1632
{
1629
1633
// Statics may be cyclic and evaluating them too early
1630
1634
// in the MIR pipeline may cause cycle errors even though
You can’t perform that action at this time.
0 commit comments