Rollup merge of #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
This commit is contained in:
Guillaume Gomez 2019-02-10 21:45:21 +01:00 committed by GitHub
commit c3aa84700a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -823,6 +823,8 @@ where
let src = match self.try_read_immediate(src)? {
Ok(src_val) => {
// Yay, we got a value that we can write directly.
// FIXME: Add a check to make sure that if `src` is indirect,
// it does not overlap with `dest`.
return self.write_immediate_no_validate(src_val, dest);
}
Err(mplace) => mplace,
@ -836,7 +838,8 @@ where
self.memory.copy(
src_ptr, src_align,
dest_ptr, dest_align,
dest.layout.size, false
dest.layout.size,
/*nonoverlapping*/ true,
)?;
Ok(())