@@ -5,7 +5,7 @@ use rustc::hir;
55
66use crate :: {
77 EvalResult , MiriEvalContext , HelpersEvalContextExt ,
8- MemoryKind , MiriMemoryKind , RangeMap , AllocId ,
8+ MemoryKind , MiriMemoryKind , RangeMap , AllocId , Allocation , AllocationExtra ,
99 Pointer , PlaceTy , MPlaceTy ,
1010} ;
1111
@@ -343,27 +343,30 @@ impl<'tcx> Stacks {
343343}
344344
345345/// Hooks and glue
346- impl < ' tcx > Stacks {
346+ impl AllocationExtra < Borrow > for Stacks {
347347 #[ inline( always) ]
348- pub fn memory_read (
349- & self ,
348+ fn memory_read < ' tcx > (
349+ alloc : & Allocation < Borrow , Stacks > ,
350350 ptr : Pointer < Borrow > ,
351351 size : Size ,
352352 ) -> EvalResult < ' tcx > {
353353 // 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 )
355355 }
356356
357357 #[ inline( always) ]
358- pub fn memory_written (
359- & mut self ,
358+ fn memory_written < ' tcx > (
359+ alloc : & mut Allocation < Borrow , Stacks > ,
360360 ptr : Pointer < Borrow > ,
361361 size : Size ,
362362 ) -> EvalResult < ' tcx > {
363363 // 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 )
365365 }
366+ }
366367
368+ impl < ' tcx > Stacks {
369+ #[ inline( always) ]
367370 pub fn memory_deallocated (
368371 & mut self ,
369372 ptr : Pointer < Borrow > ,
0 commit comments