@@ -105,7 +105,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
105
105
106
106
#[ inline]
107
107
pub fn tag_static_base_pointer ( & self , ptr : Pointer ) -> Pointer < M :: PointerTag > {
108
- ptr. with_tag ( M :: tag_static_base_pointer ( ptr. alloc_id , & self . extra ) )
108
+ ptr. with_tag ( M :: tag_static_base_pointer ( ptr. alloc_id , & self ) )
109
109
}
110
110
111
111
pub fn create_fn_alloc ( & mut self , instance : Instance < ' tcx > ) -> Pointer < M :: PointerTag > {
@@ -138,7 +138,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
138
138
kind : MemoryKind < M :: MemoryKinds > ,
139
139
) -> Pointer < M :: PointerTag > {
140
140
let id = self . tcx . alloc_map . lock ( ) . reserve ( ) ;
141
- let ( alloc, tag) = M :: tag_allocation ( id, Cow :: Owned ( alloc) , Some ( kind) , & self . extra ) ;
141
+ let ( alloc, tag) = M :: tag_allocation ( id, Cow :: Owned ( alloc) , Some ( kind) , & self ) ;
142
142
self . alloc_map . insert ( id, ( kind, alloc. into_owned ( ) ) ) ;
143
143
Pointer :: from ( id) . with_tag ( tag)
144
144
}
@@ -325,7 +325,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
325
325
fn get_static_alloc (
326
326
id : AllocId ,
327
327
tcx : TyCtxtAt < ' tcx > ,
328
- memory_extra : & M :: MemoryExtra ,
328
+ memory : & Memory < ' mir , ' tcx , M > ,
329
329
) -> InterpResult < ' tcx , Cow < ' tcx , Allocation < M :: PointerTag , M :: AllocExtra > > > {
330
330
let alloc = tcx. alloc_map . lock ( ) . get ( id) ;
331
331
let alloc = match alloc {
@@ -372,7 +372,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
372
372
id, // always use the ID we got as input, not the "hidden" one.
373
373
alloc,
374
374
M :: STATIC_KIND . map ( MemoryKind :: Machine ) ,
375
- memory_extra
375
+ memory
376
376
) . 0 )
377
377
}
378
378
@@ -385,7 +385,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
385
385
// `get_static_alloc` that we can actually use directly without inserting anything anywhere.
386
386
// So the error type is `InterpResult<'tcx, &Allocation<M::PointerTag>>`.
387
387
let a = self . alloc_map . get_or ( id, || {
388
- let alloc = Self :: get_static_alloc ( id, self . tcx , & self . extra ) . map_err ( Err ) ?;
388
+ let alloc = Self :: get_static_alloc ( id, self . tcx , & self ) . map_err ( Err ) ?;
389
389
match alloc {
390
390
Cow :: Borrowed ( alloc) => {
391
391
// We got a ref, cheaply return that as an "error" so that the
@@ -414,11 +414,11 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
414
414
id : AllocId ,
415
415
) -> InterpResult < ' tcx , & mut Allocation < M :: PointerTag , M :: AllocExtra > > {
416
416
let tcx = self . tcx ;
417
- let memory_extra = & self . extra ;
417
+ let alloc = Self :: get_static_alloc ( id , tcx , & self ) ;
418
418
let a = self . alloc_map . get_mut_or ( id, || {
419
419
// Need to make a copy, even if `get_static_alloc` is able
420
420
// to give us a cheap reference.
421
- let alloc = Self :: get_static_alloc ( id , tcx , memory_extra ) ?;
421
+ let alloc = alloc ?;
422
422
if alloc. mutability == Mutability :: Immutable {
423
423
return err ! ( ModifiedConstantMemory ) ;
424
424
}
0 commit comments