diff options
| author | Ralf Jung <post@ralfj.de> | 2023-07-07 16:54:44 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2023-07-07 16:54:44 +0200 |
| commit | 7a83ef82da92d81be83d430602778f4f4c8fb439 (patch) | |
| tree | fbe69d57ce652cf0dcd466de94095c4c9ab1ef6c /compiler/rustc_const_eval | |
| parent | 1a449dcfd25143f7e1f6b6f5ddf1c12af361e2ff (diff) | |
| download | rust-7a83ef82da92d81be83d430602778f4f4c8fb439.tar.gz rust-7a83ef82da92d81be83d430602778f4f4c8fb439.zip | |
miri: check that assignments do not self-overlap
Diffstat (limited to 'compiler/rustc_const_eval')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/place.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/place.rs b/compiler/rustc_const_eval/src/interpret/place.rs index 24c1fe43d0c..ca1106384fd 100644 --- a/compiler/rustc_const_eval/src/interpret/place.rs +++ b/compiler/rustc_const_eval/src/interpret/place.rs @@ -700,8 +700,13 @@ where assert_eq!(src.layout.size, dest.layout.size); } + // Setting `nonoverlapping` here only has an effect when we don't hit the fast-path above, + // but that should at least match what LLVM does where `memcpy` is also only used when the + // type does not have Scalar/ScalarPair layout. + // (Or as the `Assign` docs put it, assignments "not producing primitives" must be + // non-overlapping.) self.mem_copy( - src.ptr, src.align, dest.ptr, dest.align, dest_size, /*nonoverlapping*/ false, + src.ptr, src.align, dest.ptr, dest.align, dest_size, /*nonoverlapping*/ true, ) } |
