miri: add test for overlapping typed_swap

This commit is contained in:
Ralf Jung 2024-12-25 10:45:48 +01:00
parent 6de3a2e3a9
commit 00dfa3ba2d
3 changed files with 29 additions and 1 deletions

View file

@ -649,7 +649,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
let kind = MemoryKind::Stack;
let temp = self.allocate(left.layout, kind)?;
self.copy_op(&left, &temp)?;
self.copy_op(&right, &left)?;
self.copy_op(&right, &left)?; // this checks that they are non-overlapping
self.copy_op(&temp, &right)?;
self.deallocate_ptr(temp.ptr(), None, kind)?;
interp_ok(())