@@ -1057,20 +1057,19 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
1057
1057
Some ( dest_ptr) => dest_ptr,
1058
1058
} ;
1059
1059
1060
+ // This checks relocation edges on the src, which needs to happen before
1061
+ // `prepare_relocation_copy`.
1062
+ let src_bytes = src_alloc
1063
+ . get_bytes_with_uninit_and_ptr ( & tcx, src_range)
1064
+ . map_err ( |e| e. to_interp_error ( src_alloc_id) ) ?
1065
+ . as_ptr ( ) ; // raw ptr, so we can also get a ptr to the destination allocation
1060
1066
// first copy the relocations to a temporary buffer, because
1061
1067
// `get_bytes_mut` will clear the relocations, which is correct,
1062
1068
// since we don't want to keep any relocations at the target.
1063
- // (`get_bytes_with_uninit_and_ptr` below checks that there are no
1064
- // relocations overlapping the edges; those would not be handled correctly).
1065
1069
let relocations =
1066
1070
src_alloc. prepare_relocation_copy ( self , src_range, dest_offset, num_copies) ;
1067
1071
// Prepare a copy of the initialization mask.
1068
1072
let compressed = src_alloc. compress_uninit_range ( src_range) ;
1069
- // This checks relocation edges on the src.
1070
- let src_bytes = src_alloc
1071
- . get_bytes_with_uninit_and_ptr ( & tcx, src_range)
1072
- . map_err ( |e| e. to_interp_error ( src_alloc_id) ) ?
1073
- . as_ptr ( ) ; // raw ptr, so we can also get a ptr to the destination allocation
1074
1073
1075
1074
// Destination alloc preparations and access hooks.
1076
1075
let ( dest_alloc, extra) = self . get_raw_mut ( dest_alloc_id) ?;
0 commit comments