@@ -40,9 +40,16 @@ pub trait AllocBytes: Clone + fmt::Debug + Deref<Target = [u8]> + DerefMut<Targe
4040    /// Gives direct access to the raw underlying storage. 
4141/// 
4242/// Crucially this pointer is compatible with: 
43- /// - other pointers retunred  by this method, and 
43+ /// - other pointers returned  by this method, and 
4444/// - references returned from `deref()`, as long as there was no write. 
4545fn  as_mut_ptr ( & mut  self )  -> * mut  u8 ; 
46+ 
47+     /// Gives direct access to the raw underlying storage. 
48+ /// 
49+ /// Crucially this pointer is compatible with: 
50+ /// - other pointers returned by this method, and 
51+ /// - references returned from `deref()`, as long as there was no write. 
52+ fn  as_ptr ( & self )  -> * const  u8 ; 
4653} 
4754
4855/// Default `bytes` for `Allocation` is a `Box<u8>`. 
@@ -62,6 +69,11 @@ impl AllocBytes for Box<[u8]> {
6269        // Carefully avoiding any intermediate references. 
6370        ptr:: addr_of_mut!( * * self ) . cast ( ) 
6471    } 
72+ 
73+     fn  as_ptr ( & self )  -> * const  u8  { 
74+         // Carefully avoiding any intermediate references. 
75+         ptr:: addr_of!( * * self ) . cast ( ) 
76+     } 
6577} 
6678
6779/// This type represents an Allocation in the Miri/CTFE core engine. 
@@ -490,19 +502,27 @@ impl<Prov: Provenance, Extra, Bytes: AllocBytes> Allocation<Prov, Extra, Bytes>
490502        self . provenance . clear ( range,  cx) ?; 
491503
492504        assert ! ( range. end( ) . bytes_usize( )  <= self . bytes. len( ) ) ;  // need to do our own bounds-check 
493-         // Cruciall , we go via `AllocBytes::as_mut_ptr`, not `AllocBytes::deref_mut`. 
505+         // Crucially , we go via `AllocBytes::as_mut_ptr`, not `AllocBytes::deref_mut`. 
494506        let  begin_ptr = self . bytes . as_mut_ptr ( ) . wrapping_add ( range. start . bytes_usize ( ) ) ; 
495507        let  len = range. end ( ) . bytes_usize ( )  - range. start . bytes_usize ( ) ; 
496508        Ok ( ptr:: slice_from_raw_parts_mut ( begin_ptr,  len) ) 
497509    } 
498510
499511    /// This gives direct mutable access to the entire buffer, just exposing their internal state 
500- /// without reseting  anything. Directly exposes `AllocBytes::as_mut_ptr`. Only works if 
512+ /// without resetting  anything. Directly exposes `AllocBytes::as_mut_ptr`. Only works if 
501513/// `OFFSET_IS_ADDR` is true. 
502514pub  fn  get_bytes_unchecked_raw_mut ( & mut  self )  -> * mut  u8  { 
503515        assert ! ( Prov :: OFFSET_IS_ADDR ) ; 
504516        self . bytes . as_mut_ptr ( ) 
505517    } 
518+ 
519+     /// This gives direct immutable access to the entire buffer, just exposing their internal state 
520+ /// without resetting anything. Directly exposes `AllocBytes::as_ptr`. Only works if 
521+ /// `OFFSET_IS_ADDR` is true. 
522+ pub  fn  get_bytes_unchecked_raw ( & self )  -> * const  u8  { 
523+         assert ! ( Prov :: OFFSET_IS_ADDR ) ; 
524+         self . bytes . as_ptr ( ) 
525+     } 
506526} 
507527
508528/// Reading and writing. 
0 commit comments