]> git.lizzy.rs Git - rust.git/commitdiff
operand-to-place copies should never be overlapping
authorRalf Jung <post@ralfj.de>
Sat, 9 Feb 2019 18:58:41 +0000 (19:58 +0100)
committerRalf Jung <post@ralfj.de>
Sat, 9 Feb 2019 20:24:29 +0000 (21:24 +0100)
src/librustc_mir/interpret/place.rs

index 9ca7f9d8e27ff43214f0dd1817dd7339891e3b7d..3d6fcae0cab8c7330e6a353d645414108eda30e5 100644 (file)
@@ -823,6 +823,8 @@ fn copy_op_no_validate(
         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 @@ fn copy_op_no_validate(
         self.memory.copy(
             src_ptr, src_align,
             dest_ptr, dest_align,
-            dest.layout.size, false
+            dest.layout.size,
+            /*nonoverlapping*/ true,
         )?;
 
         Ok(())