@@ -1057,20 +1057,19 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
10571057 Some ( dest_ptr) => dest_ptr,
10581058 } ;
10591059
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
10601066 // first copy the relocations to a temporary buffer, because
10611067 // `get_bytes_mut` will clear the relocations, which is correct,
10621068 // 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).
10651069 let relocations =
10661070 src_alloc. prepare_relocation_copy ( self , src_range, dest_offset, num_copies) ;
10671071 // Prepare a copy of the initialization mask.
10681072 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
10741073
10751074 // Destination alloc preparations and access hooks.
10761075 let ( dest_alloc, extra) = self . get_raw_mut ( dest_alloc_id) ?;
0 commit comments