Skip to content

Commit

Permalink
take back half-baked noaliasing check in Assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Jun 2, 2022
1 parent 5e6bb83 commit 7676f07
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 1 addition & 3 deletions compiler/rustc_const_eval/src/interpret/place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -869,8 +869,6 @@ where
Ok(src_val) => {
assert!(!src.layout.is_unsized(), "cannot have unsized immediates");
// 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,
Expand All @@ -890,7 +888,7 @@ where
});
assert_eq!(src.meta, dest.meta, "Can only copy between equally-sized instances");

self.mem_copy(src.ptr, src.align, dest.ptr, dest.align, size, /*nonoverlapping*/ true)
self.mem_copy(src.ptr, src.align, dest.ptr, dest.align, size, /*nonoverlapping*/ false)
}

/// Copies the data from an operand to a place. The layouts may disagree, but they must
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_const_eval/src/interpret/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
place: mir::Place<'tcx>,
) -> InterpResult<'tcx> {
let dest = self.eval_place(place)?;
// FIXME: ensure some kind of non-aliasing between LHS and RHS?
// Also see https://github.com/rust-lang/rust/issues/68364.

use rustc_middle::mir::Rvalue::*;
match *rvalue {
Expand Down

0 comments on commit 7676f07

Please sign in to comment.