@@ -185,8 +185,11 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
185185panic ! ( "Miri ran out of memory: cannot create allocation of {size:?} bytes" )
186186} ) ;
187187let ptr = prepared_bytes. as_ptr ( ) ;
188- // Store prepared allocation space to be picked up for use later.
189- global_state. prepared_alloc_bytes . try_insert ( alloc_id, prepared_bytes) . unwrap ( ) ;
188+ // Store prepared allocation space to be picked up for use later.
189+ global_state
190+ . prepared_alloc_bytes
191+ . try_insert ( alloc_id, prepared_bytes)
192+ . unwrap ( ) ;
190193 ptr
191194} else {
192195 ecx. get_alloc_bytes_unchecked_raw ( alloc_id) ?
@@ -196,16 +199,19 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
196199}
197200AllocKind :: Function | AllocKind :: VTable => {
198201// Allocate some dummy memory to get a unique address for this function/vtable.
199- let alloc_bytes = MiriAllocBytes :: from_bytes ( & [ 0u8 ; 1 ] , Align :: from_bytes ( 1 ) . unwrap ( ) ) ;
202+ let alloc_bytes = MiriAllocBytes :: from_bytes (
203+ & [ 0u8 ; 1 ] ,
204+ Align :: from_bytes ( 1 ) . unwrap ( ) ,
205+ ) ;
200206// We don't need to expose these bytes as nobody is allowed to access them.
201207let addr = alloc_bytes. as_ptr ( ) . addr ( ) . try_into ( ) . unwrap ( ) ;
202208// Leak the underlying memory to ensure it remains unique.
203209 std:: mem:: forget ( alloc_bytes) ;
204210 addr
205211}
206- AllocKind :: Dead => unreachable ! ( )
212+ AllocKind :: Dead => unreachable ! ( ) ,
207213}
208- } else if let Some ( ( reuse_addr, clock) ) = global_state. reuse . take_addr (
214+ } else if let Some ( ( reuse_addr, clock) ) = global_state. reuse . take_addr (
209215& mut * rng,
210216 size,
211217 align,
@@ -359,7 +365,13 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
359365
360366// This returns some prepared `MiriAllocBytes`, either because `addr_from_alloc_id` reserved
361367// memory space in the past, or by doing the pre-allocation right upon being called.
362- fn get_global_alloc_bytes ( & self , id : AllocId , kind : MemoryKind , bytes : & [ u8 ] , align : Align ) -> InterpResult < ' tcx , MiriAllocBytes > {
368+ fn get_global_alloc_bytes (
369+ & self ,
370+ id : AllocId ,
371+ kind : MemoryKind ,
372+ bytes : & [ u8 ] ,
373+ align : Align ,
374+ ) -> InterpResult < ' tcx , MiriAllocBytes > {
363375let ecx = self . eval_context_ref ( ) ;
364376Ok ( if ecx. machine . native_lib . is_some ( ) {
365377// In native lib mode, MiriAllocBytes for global allocations are handled via `prepared_alloc_bytes`.
0 commit comments