@@ -230,7 +230,7 @@ impl<'tcx> Stack {
230
230
}
231
231
232
232
if !item. protected ( ) {
233
- return Ok ( ( ) ) ;
233
+ return interp_ok ( ( ) ) ;
234
234
}
235
235
236
236
// We store tags twice, once in global.protected_tags and once in each call frame.
@@ -252,10 +252,10 @@ impl<'tcx> Stack {
252
252
let allowed = matches ! ( cause, ItemInvalidationCause :: Dealloc )
253
253
&& matches ! ( protector_kind, ProtectorKind :: WeakProtector ) ;
254
254
if !allowed {
255
- return Err ( dcx. protector_error ( item, protector_kind) . into ( ) ) ;
255
+ return Err ( dcx. protector_error ( item, protector_kind) ) . into ( ) ;
256
256
}
257
257
}
258
- Ok ( ( ) )
258
+ interp_ok ( ( ) )
259
259
}
260
260
261
261
/// Test if a memory `access` using pointer tagged `tag` is granted.
@@ -295,7 +295,7 @@ impl<'tcx> Stack {
295
295
self . pop_items_after ( first_incompatible_idx, |item| {
296
296
Stack :: item_invalidated ( & item, global, dcx, ItemInvalidationCause :: Conflict ) ?;
297
297
dcx. log_invalidation ( item. tag ( ) ) ;
298
- Ok ( ( ) )
298
+ interp_ok ( ( ) )
299
299
} ) ?;
300
300
} else {
301
301
// On a read, *disable* all `Unique` above the granting item. This ensures U2 for read accesses.
@@ -316,7 +316,7 @@ impl<'tcx> Stack {
316
316
self . disable_uniques_starting_at ( first_incompatible_idx, |item| {
317
317
Stack :: item_invalidated ( & item, global, dcx, ItemInvalidationCause :: Conflict ) ?;
318
318
dcx. log_invalidation ( item. tag ( ) ) ;
319
- Ok ( ( ) )
319
+ interp_ok ( ( ) )
320
320
} ) ?;
321
321
}
322
322
@@ -345,7 +345,7 @@ impl<'tcx> Stack {
345
345
}
346
346
347
347
// Done.
348
- Ok ( ( ) )
348
+ interp_ok ( ( ) )
349
349
}
350
350
351
351
/// Deallocate a location: Like a write access, but also there must be no
@@ -367,7 +367,7 @@ impl<'tcx> Stack {
367
367
Stack :: item_invalidated ( & item, global, dcx, ItemInvalidationCause :: Dealloc ) ?;
368
368
}
369
369
370
- Ok ( ( ) )
370
+ interp_ok ( ( ) )
371
371
}
372
372
373
373
/// Derive a new pointer from one with the given tag.
@@ -418,7 +418,7 @@ impl<'tcx> Stack {
418
418
"reborrow: forgetting stack entirely due to SharedReadWrite reborrow from wildcard or unknown"
419
419
) ;
420
420
self . set_unknown_bottom ( global. next_ptr_tag ) ;
421
- return Ok ( ( ) ) ;
421
+ return interp_ok ( ( ) ) ;
422
422
} ;
423
423
424
424
// SharedReadWrite can coexist with "existing loans", meaning they don't act like a write
@@ -431,7 +431,7 @@ impl<'tcx> Stack {
431
431
// Put the new item there.
432
432
trace ! ( "reborrow: adding item {:?}" , new) ;
433
433
self . insert ( new_idx, new) ;
434
- Ok ( ( ) )
434
+ interp_ok ( ( ) )
435
435
}
436
436
}
437
437
// # Stacked Borrows Core End
@@ -491,7 +491,7 @@ impl<'tcx> Stacks {
491
491
f ( stack, & mut dcx, & mut self . exposed_tags ) ?;
492
492
dcx_builder = dcx. unbuild ( ) ;
493
493
}
494
- Ok ( ( ) )
494
+ interp_ok ( ( ) )
495
495
}
496
496
}
497
497
@@ -576,7 +576,7 @@ impl Stacks {
576
576
self . for_each ( alloc_range ( Size :: ZERO , size) , dcx, |stack, dcx, exposed_tags| {
577
577
stack. dealloc ( tag, & state, dcx, exposed_tags)
578
578
} ) ?;
579
- Ok ( ( ) )
579
+ interp_ok ( ( ) )
580
580
}
581
581
}
582
582
@@ -623,7 +623,7 @@ trait EvalContextPrivExt<'tcx, 'ecx>: crate::MiriInterpCxExt<'tcx> {
623
623
drop ( global) ; // don't hold that reference any longer than we have to
624
624
625
625
let Some ( ( alloc_id, base_offset, orig_tag) ) = loc else {
626
- return Ok ( ( ) )
626
+ return interp_ok ( ( ) )
627
627
} ;
628
628
629
629
let ( _size, _align, alloc_kind) = this. get_alloc_info ( alloc_id) ;
@@ -655,7 +655,7 @@ trait EvalContextPrivExt<'tcx, 'ecx>: crate::MiriInterpCxExt<'tcx> {
655
655
// No stacked borrows on these allocations.
656
656
}
657
657
}
658
- Ok ( ( ) )
658
+ interp_ok ( ( ) )
659
659
} ;
660
660
661
661
if size == Size :: ZERO {
@@ -676,12 +676,12 @@ trait EvalContextPrivExt<'tcx, 'ecx>: crate::MiriInterpCxExt<'tcx> {
676
676
{
677
677
log_creation ( this, Some ( ( alloc_id, base_offset, orig_tag) ) ) ?;
678
678
// Still give it the new provenance, it got retagged after all.
679
- return Ok ( Some ( Provenance :: Concrete { alloc_id, tag : new_tag } ) ) ;
679
+ return interp_ok ( Some ( Provenance :: Concrete { alloc_id, tag : new_tag } ) ) ;
680
680
} else {
681
681
// This pointer doesn't come with an AllocId. :shrug:
682
682
log_creation ( this, None ) ?;
683
683
// Provenance unchanged.
684
- return Ok ( place. ptr ( ) . provenance ) ;
684
+ return interp_ok ( place. ptr ( ) . provenance ) ;
685
685
}
686
686
}
687
687
@@ -800,12 +800,12 @@ trait EvalContextPrivExt<'tcx, 'ecx>: crate::MiriInterpCxExt<'tcx> {
800
800
) ?;
801
801
}
802
802
}
803
- Ok ( ( ) )
803
+ interp_ok ( ( ) )
804
804
} ) ?;
805
805
}
806
806
}
807
807
808
- Ok ( Some ( Provenance :: Concrete { alloc_id, tag : new_tag } ) )
808
+ interp_ok ( Some ( Provenance :: Concrete { alloc_id, tag : new_tag } ) )
809
809
}
810
810
811
811
fn sb_retag_place (
@@ -832,7 +832,7 @@ trait EvalContextPrivExt<'tcx, 'ecx>: crate::MiriInterpCxExt<'tcx> {
832
832
* shown = true ;
833
833
this. emit_diagnostic ( NonHaltingDiagnostic :: ExternTypeReborrow ) ;
834
834
} ) ;
835
- return Ok ( place. clone ( ) ) ;
835
+ return interp_ok ( place. clone ( ) ) ;
836
836
}
837
837
} ;
838
838
@@ -845,7 +845,7 @@ trait EvalContextPrivExt<'tcx, 'ecx>: crate::MiriInterpCxExt<'tcx> {
845
845
// Adjust place.
846
846
// (If the closure gets called, that means the old provenance was `Some`, and hence the new
847
847
// one must also be `Some`.)
848
- Ok ( place. clone ( ) . map_provenance ( |_| new_prov. unwrap ( ) ) )
848
+ interp_ok ( place. clone ( ) . map_provenance ( |_| new_prov. unwrap ( ) ) )
849
849
}
850
850
851
851
/// Retags an individual pointer, returning the retagged version.
@@ -859,7 +859,7 @@ trait EvalContextPrivExt<'tcx, 'ecx>: crate::MiriInterpCxExt<'tcx> {
859
859
let this = self . eval_context_mut ( ) ;
860
860
let place = this. ref_to_mplace ( val) ?;
861
861
let new_place = this. sb_retag_place ( & place, new_perm, info) ?;
862
- Ok ( ImmTy :: from_immediate ( new_place. to_ref ( this) , val. layout ) )
862
+ interp_ok ( ImmTy :: from_immediate ( new_place. to_ref ( this) , val. layout ) )
863
863
}
864
864
}
865
865
@@ -917,7 +917,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
917
917
in_field : self . in_field ,
918
918
} ) ?;
919
919
self . ecx . write_immediate ( * val, place) ?;
920
- Ok ( ( ) )
920
+ interp_ok ( ( ) )
921
921
}
922
922
}
923
923
impl < ' ecx , ' tcx > ValueVisitor < ' tcx , MiriMachine < ' tcx > > for RetagVisitor < ' ecx , ' tcx > {
@@ -935,7 +935,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
935
935
let new_perm = NewPermission :: from_box_ty ( place. layout . ty , self . kind , self . ecx ) ;
936
936
self . retag_ptr_inplace ( place, new_perm) ?;
937
937
}
938
- Ok ( ( ) )
938
+ interp_ok ( ( ) )
939
939
}
940
940
941
941
fn visit_value ( & mut self , place : & PlaceTy < ' tcx > ) -> InterpResult < ' tcx > {
@@ -944,7 +944,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
944
944
// This optimization is crucial for ZSTs, because they can contain way more fields
945
945
// than we can ever visit.
946
946
if place. layout . is_sized ( ) && place. layout . size < self . ecx . pointer_size ( ) {
947
- return Ok ( ( ) ) ;
947
+ return interp_ok ( ( ) ) ;
948
948
}
949
949
950
950
// Check the type of this value to see what to do with it (retag, or recurse).
@@ -983,7 +983,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
983
983
}
984
984
}
985
985
986
- Ok ( ( ) )
986
+ interp_ok ( ( ) )
987
987
}
988
988
}
989
989
}
@@ -1028,7 +1028,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
1028
1028
// No stacked borrows on these allocations.
1029
1029
}
1030
1030
}
1031
- Ok ( ( ) )
1031
+ interp_ok ( ( ) )
1032
1032
}
1033
1033
1034
1034
fn print_stacks ( & mut self , alloc_id : AllocId ) -> InterpResult < ' tcx > {
@@ -1046,6 +1046,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
1046
1046
}
1047
1047
println ! ( " ]" ) ;
1048
1048
}
1049
- Ok ( ( ) )
1049
+ interp_ok ( ( ) )
1050
1050
}
1051
1051
}
0 commit comments