@@ -5,7 +5,7 @@ use rustc::hir;
5
5
6
6
use crate :: {
7
7
EvalResult , MiriEvalContext , HelpersEvalContextExt ,
8
- MemoryKind , MiriMemoryKind , RangeMap , AllocId ,
8
+ MemoryKind , MiriMemoryKind , RangeMap , AllocId , Allocation , AllocationExtra ,
9
9
Pointer , PlaceTy , MPlaceTy ,
10
10
} ;
11
11
@@ -343,27 +343,30 @@ impl<'tcx> Stacks {
343
343
}
344
344
345
345
/// Hooks and glue
346
- impl < ' tcx > Stacks {
346
+ impl AllocationExtra < Borrow > for Stacks {
347
347
#[ inline( always) ]
348
- pub fn memory_read (
349
- & self ,
348
+ fn memory_read < ' tcx > (
349
+ alloc : & Allocation < Borrow , Stacks > ,
350
350
ptr : Pointer < Borrow > ,
351
351
size : Size ,
352
352
) -> EvalResult < ' tcx > {
353
353
// Reads behave exactly like the first half of a reborrow-to-shr
354
- self . use_and_maybe_re_borrow ( ptr, size, UsageKind :: Read , None )
354
+ alloc . extra . use_and_maybe_re_borrow ( ptr, size, UsageKind :: Read , None )
355
355
}
356
356
357
357
#[ inline( always) ]
358
- pub fn memory_written (
359
- & mut self ,
358
+ fn memory_written < ' tcx > (
359
+ alloc : & mut Allocation < Borrow , Stacks > ,
360
360
ptr : Pointer < Borrow > ,
361
361
size : Size ,
362
362
) -> EvalResult < ' tcx > {
363
363
// Writes behave exactly like the first half of a reborrow-to-mut
364
- self . use_and_maybe_re_borrow ( ptr, size, UsageKind :: Write , None )
364
+ alloc . extra . use_and_maybe_re_borrow ( ptr, size, UsageKind :: Write , None )
365
365
}
366
+ }
366
367
368
+ impl < ' tcx > Stacks {
369
+ #[ inline( always) ]
367
370
pub fn memory_deallocated (
368
371
& mut self ,
369
372
ptr : Pointer < Borrow > ,
0 commit comments