File tree Expand file tree Collapse file tree 2 files changed +3
-9
lines changed
rustc_const_eval/src/interpret Expand file tree Collapse file tree 2 files changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -459,10 +459,9 @@ pub fn intern_const_alloc_for_constprop<
459459 M : CompileTimeMachine < ' mir , ' tcx , T > ,
460460> (
461461 ecx : & mut InterpCx < ' mir , ' tcx , M > ,
462- ret : & MPlaceTy < ' tcx > ,
462+ alloc_id : AllocId ,
463463) -> InterpResult < ' tcx , ( ) > {
464464 // Move allocation to `tcx`.
465- let alloc_id = ret. ptr ( ) . provenance . unwrap ( ) ;
466465 let Some ( ( _, mut alloc) ) = ecx. memory . alloc_map . remove ( & alloc_id) else {
467466 // Pointer not found in local memory map. It is either a pointer to the global
468467 // map, or dangling.
Original file line number Diff line number Diff line change @@ -61,7 +61,6 @@ use rustc_hir::def::DefKind;
6161use rustc_index:: bit_set:: BitSet ;
6262use rustc_index:: IndexVec ;
6363use rustc_macros:: newtype_index;
64- use rustc_middle:: mir:: interpret:: GlobalAlloc ;
6564use rustc_middle:: mir:: visit:: * ;
6665use rustc_middle:: mir:: * ;
6766use rustc_middle:: ty:: layout:: LayoutOf ;
@@ -861,14 +860,10 @@ fn op_to_prop_const<'tcx>(
861860 return None ;
862861 }
863862
864- intern_const_alloc_for_constprop ( ecx, & mplace) . ok ( ) ?;
865863 let pointer = mplace. ptr ( ) . into_pointer_or_addr ( ) . ok ( ) ?;
866864 let ( alloc_id, offset) = pointer. into_parts ( ) ;
867- match ecx. tcx . global_alloc ( alloc_id) {
868- GlobalAlloc :: Memory ( _) => return Some ( ConstValue :: Indirect { alloc_id, offset } ) ,
869- // Fallthrough to copying the data.
870- _ => { }
871- }
865+ intern_const_alloc_for_constprop ( ecx, alloc_id) . ok ( ) ?;
866+ return Some ( ConstValue :: Indirect { alloc_id, offset } ) ;
872867 }
873868
874869 // Everything failed: create a new allocation to hold the data.
You can’t perform that action at this time.
0 commit comments