@@ -210,7 +210,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
210210        let  new_ptr = self . allocate ( new_size,  new_align,  kind) ; 
211211        let  old_size = match  old_size_and_align { 
212212            Some ( ( size,  _align) )  => size, 
213-             None  => self . get ( ptr. alloc_id ) ?. size , 
213+             None  => self . get_raw ( ptr. alloc_id ) ?. size , 
214214        } ; 
215215        self . copy ( 
216216            ptr, 
@@ -480,7 +480,9 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
480480        ) . 0 ) 
481481    } 
482482
483-     pub  fn  get ( 
483+     /// Gives raw access to the `Allocation`, without bounds or alignment checks. 
484+ /// Use the higher-level, `PlaceTy`- and `OpTy`-based APIs in `InterpCtx` instead! 
485+ pub  fn  get_raw ( 
484486        & self , 
485487        id :  AllocId , 
486488    )  -> InterpResult < ' tcx ,  & Allocation < M :: PointerTag ,  M :: AllocExtra > >  { 
@@ -513,7 +515,9 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
513515        } 
514516    } 
515517
516-     pub  fn  get_mut ( 
518+     /// Gives raw mutable access to the `Allocation`, without bounds or alignment checks. 
519+ /// Use the higher-level, `PlaceTy`- and `OpTy`-based APIs in `InterpCtx` instead! 
520+ pub  fn  get_raw_mut ( 
517521        & mut  self , 
518522        id :  AllocId , 
519523    )  -> InterpResult < ' tcx ,  & mut  Allocation < M :: PointerTag ,  M :: AllocExtra > >  { 
@@ -555,7 +559,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
555559        liveness :  AllocCheck , 
556560    )  -> InterpResult < ' static ,  ( Size ,  Align ) >  { 
557561        // # Regular allocations 
558-         // Don't use `self.get ` here as that will 
562+         // Don't use `self.get_raw ` here as that will 
559563        // a) cause cycles in case `id` refers to a static 
560564        // b) duplicate a static's allocation in miri 
561565        if  let  Some ( ( _,  alloc) )  = self . alloc_map . get ( id)  { 
@@ -627,7 +631,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
627631    } 
628632
629633    pub  fn  mark_immutable ( & mut  self ,  id :  AllocId )  -> InterpResult < ' tcx >  { 
630-         self . get_mut ( id) ?. mutability  = Mutability :: Immutable ; 
634+         self . get_raw_mut ( id) ?. mutability  = Mutability :: Immutable ; 
631635        Ok ( ( ) ) 
632636    } 
633637
@@ -776,15 +780,15 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
776780            Some ( ptr)  => ptr, 
777781            None  => return  Ok ( & [ ] ) ,  // zero-sized access 
778782        } ; 
779-         self . get ( ptr. alloc_id ) ?. get_bytes ( self ,  ptr,  size) 
783+         self . get_raw ( ptr. alloc_id ) ?. get_bytes ( self ,  ptr,  size) 
780784    } 
781785
782786    /// Reads a 0-terminated sequence of bytes from memory. Returns them as a slice. 
783787/// 
784788/// Performs appropriate bounds checks. 
785789pub  fn  read_c_str ( & self ,  ptr :  Scalar < M :: PointerTag > )  -> InterpResult < ' tcx ,  & [ u8 ] >  { 
786790        let  ptr = self . force_ptr ( ptr) ?;  // We need to read at least 1 byte, so we *need* a ptr. 
787-         self . get ( ptr. alloc_id ) ?. read_c_str ( self ,  ptr) 
791+         self . get_raw ( ptr. alloc_id ) ?. read_c_str ( self ,  ptr) 
788792    } 
789793
790794    /// Writes the given stream of bytes into memory. 
@@ -804,7 +808,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
804808            None  => return  Ok ( ( ) ) ,  // zero-sized access 
805809        } ; 
806810        let  tcx = self . tcx . tcx ; 
807-         self . get_mut ( ptr. alloc_id ) ?. write_bytes ( & tcx,  ptr,  src) 
811+         self . get_raw_mut ( ptr. alloc_id ) ?. write_bytes ( & tcx,  ptr,  src) 
808812    } 
809813
810814    /// Expects the caller to have checked bounds and alignment. 
@@ -832,16 +836,16 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
832836        // since we don't want to keep any relocations at the target. 
833837        // (`get_bytes_with_undef_and_ptr` below checks that there are no 
834838        // relocations overlapping the edges; those would not be handled correctly). 
835-         let  relocations = self . get ( src. alloc_id ) ?
839+         let  relocations = self . get_raw ( src. alloc_id ) ?
836840            . prepare_relocation_copy ( self ,  src,  size,  dest,  length) ; 
837841
838842        let  tcx = self . tcx . tcx ; 
839843
840844        // This checks relocation edges on the src. 
841-         let  src_bytes = self . get ( src. alloc_id ) ?
845+         let  src_bytes = self . get_raw ( src. alloc_id ) ?
842846            . get_bytes_with_undef_and_ptr ( & tcx,  src,  size) ?
843847            . as_ptr ( ) ; 
844-         let  dest_bytes = self . get_mut ( dest. alloc_id ) ?
848+         let  dest_bytes = self . get_raw_mut ( dest. alloc_id ) ?
845849            . get_bytes_mut ( & tcx,  dest,  size *  length) ?
846850            . as_mut_ptr ( ) ; 
847851
@@ -880,7 +884,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
880884        // copy definedness to the destination 
881885        self . copy_undef_mask ( src,  dest,  size,  length) ?; 
882886        // copy the relocations to the destination 
883-         self . get_mut ( dest. alloc_id ) ?. mark_relocation_range ( relocations) ; 
887+         self . get_raw_mut ( dest. alloc_id ) ?. mark_relocation_range ( relocations) ; 
884888
885889        Ok ( ( ) ) 
886890    } 
@@ -899,11 +903,11 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
899903        // The bits have to be saved locally before writing to dest in case src and dest overlap. 
900904        assert_eq ! ( size. bytes( )  as  usize  as  u64 ,  size. bytes( ) ) ; 
901905
902-         let  src_alloc = self . get ( src. alloc_id ) ?; 
906+         let  src_alloc = self . get_raw ( src. alloc_id ) ?; 
903907        let  compressed = src_alloc. compress_undef_range ( src,  size) ; 
904908
905909        // now fill in all the data 
906-         let  dest_allocation = self . get_mut ( dest. alloc_id ) ?; 
910+         let  dest_allocation = self . get_raw_mut ( dest. alloc_id ) ?; 
907911        dest_allocation. mark_compressed_undef_range ( & compressed,  dest,  size,  repeat) ; 
908912
909913        Ok ( ( ) ) 
0 commit comments