@@ -105,7 +105,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
105105
106106 #[ inline]
107107 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 ) )
109109 }
110110
111111 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> {
138138 kind : MemoryKind < M :: MemoryKinds > ,
139139 ) -> Pointer < M :: PointerTag > {
140140 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 ) ;
142142 self . alloc_map . insert ( id, ( kind, alloc. into_owned ( ) ) ) ;
143143 Pointer :: from ( id) . with_tag ( tag)
144144 }
@@ -325,7 +325,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
325325 fn get_static_alloc (
326326 id : AllocId ,
327327 tcx : TyCtxtAt < ' tcx > ,
328- memory_extra : & M :: MemoryExtra ,
328+ memory : & Memory < ' mir , ' tcx , M > ,
329329 ) -> InterpResult < ' tcx , Cow < ' tcx , Allocation < M :: PointerTag , M :: AllocExtra > > > {
330330 let alloc = tcx. alloc_map . lock ( ) . get ( id) ;
331331 let alloc = match alloc {
@@ -372,7 +372,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
372372 id, // always use the ID we got as input, not the "hidden" one.
373373 alloc,
374374 M :: STATIC_KIND . map ( MemoryKind :: Machine ) ,
375- memory_extra
375+ memory
376376 ) . 0 )
377377 }
378378
@@ -385,7 +385,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
385385 // `get_static_alloc` that we can actually use directly without inserting anything anywhere.
386386 // So the error type is `InterpResult<'tcx, &Allocation<M::PointerTag>>`.
387387 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 ) ?;
389389 match alloc {
390390 Cow :: Borrowed ( alloc) => {
391391 // 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> {
414414 id : AllocId ,
415415 ) -> InterpResult < ' tcx , & mut Allocation < M :: PointerTag , M :: AllocExtra > > {
416416 let tcx = self . tcx ;
417- let memory_extra = & self . extra ;
417+ let alloc = Self :: get_static_alloc ( id , tcx , & self ) ;
418418 let a = self . alloc_map . get_mut_or ( id, || {
419419 // Need to make a copy, even if `get_static_alloc` is able
420420 // to give us a cheap reference.
421- let alloc = Self :: get_static_alloc ( id , tcx , memory_extra ) ?;
421+ let alloc = alloc ?;
422422 if alloc. mutability == Mutability :: Immutable {
423423 return err ! ( ModifiedConstantMemory ) ;
424424 }
0 commit comments