@@ -343,10 +343,11 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
343343 }
344344
345345 // Let the machine take some extra action
346- M :: memory_deallocated ( & mut self . extra , & mut alloc, ptr) ?;
346+ let size = alloc. size ( ) ;
347+ M :: memory_deallocated ( & mut self . extra , & mut alloc. extra , ptr, size) ?;
347348
348349 // Don't forget to remember size and align of this now-dead allocation
349- let old = self . dead_alloc_map . insert ( ptr. alloc_id , ( alloc . size ( ) , alloc. align ) ) ;
350+ let old = self . dead_alloc_map . insert ( ptr. alloc_id , ( size, alloc. align ) ) ;
350351 if old. is_some ( ) {
351352 bug ! ( "Nothing can be deallocated twice" ) ;
352353 }
@@ -591,7 +592,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
591592 } ,
592593 ) ?;
593594 if let Some ( ( ptr, alloc) ) = ptr_and_alloc {
594- M :: memory_read ( & self . extra , alloc, ptr, size) ?;
595+ M :: memory_read ( & self . extra , & alloc. extra , ptr, size) ?;
595596 let range = alloc_range ( ptr. offset , size) ;
596597 Ok ( Some ( AllocRef { alloc, range, tcx : self . tcx , alloc_id : ptr. alloc_id } ) )
597598 } else {
@@ -660,7 +661,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
660661 // FIXME: can we somehow avoid looking up the allocation twice here?
661662 // We cannot call `get_raw_mut` inside `check_and_deref_ptr` as that would duplicate `&mut self`.
662663 let ( alloc, extra) = self . get_raw_mut ( ptr. alloc_id ) ?;
663- M :: memory_written ( extra, alloc, ptr, size) ?;
664+ M :: memory_written ( extra, & mut alloc. extra , ptr, size) ?;
664665 let range = alloc_range ( ptr. offset , size) ;
665666 Ok ( Some ( AllocRefMut { alloc, range, tcx, alloc_id : ptr. alloc_id } ) )
666667 } else {
@@ -1029,7 +1030,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
10291030 Some ( src_ptr) => src_ptr,
10301031 } ;
10311032 let src_alloc = self . get_raw ( src. alloc_id ) ?;
1032- M :: memory_read ( & self . extra , src_alloc, src, size) ?;
1033+ M :: memory_read ( & self . extra , & src_alloc. extra , src, size) ?;
10331034 // We need the `dest` ptr for the next operation, so we get it now.
10341035 // We already did the source checks and called the hooks so we are good to return early.
10351036 let dest = match dest {
@@ -1058,7 +1059,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
10581059
10591060 // Destination alloc preparations and access hooks.
10601061 let ( dest_alloc, extra) = self . get_raw_mut ( dest. alloc_id ) ?;
1061- M :: memory_written ( extra, dest_alloc, dest, size * num_copies) ?;
1062+ M :: memory_written ( extra, & mut dest_alloc. extra , dest, size * num_copies) ?;
10621063 let dest_bytes = dest_alloc
10631064 . get_bytes_mut_ptr ( & tcx, alloc_range ( dest. offset , size * num_copies) )
10641065 . as_mut_ptr ( ) ;
0 commit comments