@@ -200,7 +200,7 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
200
200
AllocKind :: Dead => unreachable ! ( ) ,
201
201
} ;
202
202
// Ensure this pointer's provenance is exposed, so that it can be used by FFI code.
203
- return Ok ( base_ptr. expose_provenance ( ) . try_into ( ) . unwrap ( ) ) ;
203
+ return interp_ok ( base_ptr. expose_provenance ( ) . try_into ( ) . unwrap ( ) ) ;
204
204
}
205
205
// We are not in native lib mode, so we control the addresses ourselves.
206
206
if let Some ( ( reuse_addr, clock) ) =
@@ -209,7 +209,7 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
209
209
if let Some ( clock) = clock {
210
210
ecx. acquire_clock ( & clock) ;
211
211
}
212
- Ok ( reuse_addr)
212
+ interp_ok ( reuse_addr)
213
213
} else {
214
214
// We have to pick a fresh address.
215
215
// Leave some space to the previous allocation, to give it some chance to be less aligned.
@@ -234,7 +234,7 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
234
234
throw_exhaust ! ( AddressSpaceFull ) ;
235
235
}
236
236
237
- Ok ( base_addr)
237
+ interp_ok ( base_addr)
238
238
}
239
239
}
240
240
@@ -248,7 +248,7 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
248
248
let global_state = & mut * global_state;
249
249
250
250
match global_state. base_addr . get ( & alloc_id) {
251
- Some ( & addr) => Ok ( addr) ,
251
+ Some ( & addr) => interp_ok ( addr) ,
252
252
None => {
253
253
// First time we're looking for the absolute address of this allocation.
254
254
let base_addr =
@@ -274,7 +274,7 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
274
274
} ;
275
275
global_state. int_to_ptr_map . insert ( pos, ( base_addr, alloc_id) ) ;
276
276
277
- Ok ( base_addr)
277
+ interp_ok ( base_addr)
278
278
}
279
279
}
280
280
}
@@ -287,20 +287,20 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
287
287
let global_state = ecx. machine . alloc_addresses . get_mut ( ) ;
288
288
// In strict mode, we don't need this, so we can save some cycles by not tracking it.
289
289
if global_state. provenance_mode == ProvenanceMode :: Strict {
290
- return Ok ( ( ) ) ;
290
+ return interp_ok ( ( ) ) ;
291
291
}
292
292
// Exposing a dead alloc is a no-op, because it's not possible to get a dead allocation
293
293
// via int2ptr.
294
294
if !ecx. is_alloc_live ( alloc_id) {
295
- return Ok ( ( ) ) ;
295
+ return interp_ok ( ( ) ) ;
296
296
}
297
297
trace ! ( "Exposing allocation id {alloc_id:?}" ) ;
298
298
let global_state = ecx. machine . alloc_addresses . get_mut ( ) ;
299
299
global_state. exposed . insert ( alloc_id) ;
300
300
if ecx. machine . borrow_tracker . is_some ( ) {
301
301
ecx. expose_tag ( alloc_id, tag) ?;
302
302
}
303
- Ok ( ( ) )
303
+ interp_ok ( ( ) )
304
304
}
305
305
306
306
fn ptr_from_addr_cast ( & self , addr : u64 ) -> InterpResult < ' tcx , Pointer > {
@@ -337,7 +337,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
337
337
// cast is fairly irrelevant. Instead we generate this as a "wildcard" pointer, such that
338
338
// *every time the pointer is used*, we do an `AllocId` lookup to find the (exposed)
339
339
// allocation it might be referencing.
340
- Ok ( Pointer :: new ( Some ( Provenance :: Wildcard ) , Size :: from_bytes ( addr) ) )
340
+ interp_ok ( Pointer :: new ( Some ( Provenance :: Wildcard ) , Size :: from_bytes ( addr) ) )
341
341
}
342
342
343
343
/// Convert a relative (tcx) pointer to a Miri pointer.
@@ -359,7 +359,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
359
359
Size :: from_bytes ( base_addr) ,
360
360
) ;
361
361
// Add offset with the right kind of pointer-overflowing arithmetic.
362
- Ok ( base_ptr. wrapping_offset ( offset, ecx) )
362
+ interp_ok ( base_ptr. wrapping_offset ( offset, ecx) )
363
363
}
364
364
365
365
// This returns some prepared `MiriAllocBytes`, either because `addr_from_alloc_id` reserved
@@ -390,9 +390,9 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
390
390
assert_eq ! ( prepared_alloc_bytes. len( ) , bytes. len( ) ) ;
391
391
// Copy allocation contents into prepared memory.
392
392
prepared_alloc_bytes. copy_from_slice ( bytes) ;
393
- Ok ( prepared_alloc_bytes)
393
+ interp_ok ( prepared_alloc_bytes)
394
394
} else {
395
- Ok ( MiriAllocBytes :: from_bytes ( std:: borrow:: Cow :: Borrowed ( bytes) , align) )
395
+ interp_ok ( MiriAllocBytes :: from_bytes ( std:: borrow:: Cow :: Borrowed ( bytes) , align) )
396
396
}
397
397
}
398
398
0 commit comments