Skip to content

Commit 7676f07

Browse files
committed
take back half-baked noaliasing check in Assignment
1 parent 5e6bb83 commit 7676f07

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

compiler/rustc_const_eval/src/interpret/place.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -869,8 +869,6 @@ where
869869
Ok(src_val) => {
870870
assert!(!src.layout.is_unsized(), "cannot have unsized immediates");
871871
// Yay, we got a value that we can write directly.
872-
// FIXME: Add a check to make sure that if `src` is indirect,
873-
// it does not overlap with `dest`.
874872
return self.write_immediate_no_validate(*src_val, dest);
875873
}
876874
Err(mplace) => mplace,
@@ -890,7 +888,7 @@ where
890888
});
891889
assert_eq!(src.meta, dest.meta, "Can only copy between equally-sized instances");
892890

893-
self.mem_copy(src.ptr, src.align, dest.ptr, dest.align, size, /*nonoverlapping*/ true)
891+
self.mem_copy(src.ptr, src.align, dest.ptr, dest.align, size, /*nonoverlapping*/ false)
894892
}
895893

896894
/// Copies the data from an operand to a place. The layouts may disagree, but they must

compiler/rustc_const_eval/src/interpret/step.rs

+2
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
158158
place: mir::Place<'tcx>,
159159
) -> InterpResult<'tcx> {
160160
let dest = self.eval_place(place)?;
161+
// FIXME: ensure some kind of non-aliasing between LHS and RHS?
162+
// Also see https://github.com/rust-lang/rust/issues/68364.
161163

162164
use rustc_middle::mir::Rvalue::*;
163165
match *rvalue {

0 commit comments

Comments
 (0)