Skip to content

Commit 6023911

Browse files
authored
Rollup merge of rust-lang#58332 - RalfJung:miri-copy-nonoverlapping, r=oli-obk
operand-to-place copies should never be overlapping This seems to just work (verified with the Miri test suite). r? @oli-obk
2 parents 27955b6 + a01efbc commit 6023911

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/librustc_mir/interpret/place.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,8 @@ where
823823
let src = match self.try_read_immediate(src)? {
824824
Ok(src_val) => {
825825
// Yay, we got a value that we can write directly.
826+
// FIXME: Add a check to make sure that if `src` is indirect,
827+
// it does not overlap with `dest`.
826828
return self.write_immediate_no_validate(src_val, dest);
827829
}
828830
Err(mplace) => mplace,
@@ -836,7 +838,8 @@ where
836838
self.memory.copy(
837839
src_ptr, src_align,
838840
dest_ptr, dest_align,
839-
dest.layout.size, false
841+
dest.layout.size,
842+
/*nonoverlapping*/ true,
840843
)?;
841844

842845
Ok(())

0 commit comments

Comments
 (0)