@@ -185,8 +185,11 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
185
185
panic ! ( "Miri ran out of memory: cannot create allocation of {size:?} bytes" )
186
186
} ) ;
187
187
let 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 ( ) ;
190
193
ptr
191
194
} else {
192
195
ecx. get_alloc_bytes_unchecked_raw ( alloc_id) ?
@@ -196,16 +199,19 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
196
199
}
197
200
AllocKind :: Function | AllocKind :: VTable => {
198
201
// 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
+ ) ;
200
206
// We don't need to expose these bytes as nobody is allowed to access them.
201
207
let addr = alloc_bytes. as_ptr ( ) . addr ( ) . try_into ( ) . unwrap ( ) ;
202
208
// Leak the underlying memory to ensure it remains unique.
203
209
std:: mem:: forget ( alloc_bytes) ;
204
210
addr
205
211
}
206
- AllocKind :: Dead => unreachable ! ( )
212
+ AllocKind :: Dead => unreachable ! ( ) ,
207
213
}
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 (
209
215
& mut * rng,
210
216
size,
211
217
align,
@@ -359,7 +365,13 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
359
365
360
366
// This returns some prepared `MiriAllocBytes`, either because `addr_from_alloc_id` reserved
361
367
// 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 > {
363
375
let ecx = self . eval_context_ref ( ) ;
364
376
Ok ( if ecx. machine . native_lib . is_some ( ) {
365
377
// In native lib mode, MiriAllocBytes for global allocations are handled via `prepared_alloc_bytes`.
0 commit comments