about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2019-02-10 21:45:21 +0100
committerGitHub <noreply@github.com>2019-02-10 21:45:21 +0100
commitc3aa84700a2c35a4dc3d61d3b929dd7b3b011998 (patch)
tree1d6d8bddbb06696f5e70c9a4d9775439d6a0b5e2 /src
parenta09aa0fde15673f8ba88a7ac082a63155f8c1ba0 (diff)
parenta01efbcbec2123429a7eaa73ce1c9198007af7cf (diff)
downloadrust-c3aa84700a2c35a4dc3d61d3b929dd7b3b011998.tar.gz
rust-c3aa84700a2c35a4dc3d61d3b929dd7b3b011998.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/librustc_mir/interpret/place.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/librustc_mir/interpret/place.rs b/src/librustc_mir/interpret/place.rs
index 9ca7f9d8e27..3d6fcae0cab 100644
--- a/src/librustc_mir/interpret/place.rs
+++ b/src/librustc_mir/interpret/place.rs
@@ -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(())