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<
459
459
M : CompileTimeMachine < ' mir , ' tcx , T > ,
460
460
> (
461
461
ecx : & mut InterpCx < ' mir , ' tcx , M > ,
462
- ret : & MPlaceTy < ' tcx > ,
462
+ alloc_id : AllocId ,
463
463
) -> InterpResult < ' tcx , ( ) > {
464
464
// Move allocation to `tcx`.
465
- let alloc_id = ret. ptr ( ) . provenance . unwrap ( ) ;
466
465
let Some ( ( _, mut alloc) ) = ecx. memory . alloc_map . remove ( & alloc_id) else {
467
466
// Pointer not found in local memory map. It is either a pointer to the global
468
467
// map, or dangling.
Original file line number Diff line number Diff line change @@ -61,7 +61,6 @@ use rustc_hir::def::DefKind;
61
61
use rustc_index:: bit_set:: BitSet ;
62
62
use rustc_index:: IndexVec ;
63
63
use rustc_macros:: newtype_index;
64
- use rustc_middle:: mir:: interpret:: GlobalAlloc ;
65
64
use rustc_middle:: mir:: visit:: * ;
66
65
use rustc_middle:: mir:: * ;
67
66
use rustc_middle:: ty:: layout:: LayoutOf ;
@@ -861,14 +860,10 @@ fn op_to_prop_const<'tcx>(
861
860
return None ;
862
861
}
863
862
864
- intern_const_alloc_for_constprop ( ecx, & mplace) . ok ( ) ?;
865
863
let pointer = mplace. ptr ( ) . into_pointer_or_addr ( ) . ok ( ) ?;
866
864
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 } ) ;
872
867
}
873
868
874
869
// Everything failed: create a new allocation to hold the data.
You can’t perform that action at this time.
0 commit comments