Skip to content

Commit 9fde038

Browse files
committed
Update interpret step
1 parent 5aba3da commit 9fde038

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

compiler/rustc_mir/src/interpret/step.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,23 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
119119

120120
let dst = {
121121
let dst = self.eval_operand(dst, None)?;
122-
dst.assert_mem_place(self)
122+
let mplace = *dst.assert_mem_place(self);
123+
match mplace.ptr {
124+
Scalar::Ptr(ptr) => ptr,
125+
_ => panic!(),
126+
}
123127
};
124128
let src = {
125129
let src = self.eval_operand(src, None)?;
126-
src.assert_mem_place(self)
130+
let mplace = *src.assert_mem_place(self);
131+
match mplace.ptr {
132+
Scalar::Ptr(ptr) => ptr,
133+
_ => panic!(),
134+
}
127135
};
128136
// Not sure how to convert an MPlaceTy<'_, <M as Machine<'_, '_>>::PointerTag>
129137
// to a pointer, or OpTy to a size
130-
self.memory.copy(src, dst, size, /*nonoverlapping*/ true)?;
138+
self.memory.copy(src, dst, size.layout.layout.size, /*nonoverlapping*/ true)?;
131139
}
132140

133141
// Statements we do not track.

compiler/rustc_mir/src/transform/coverage/spans.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,7 @@ pub(super) fn filtered_statement_span(
687687

688688
// Retain spans from all other statements
689689
StatementKind::FakeRead(_, _) // Not including `ForGuardBinding`
690+
| StatementKind::CopyNonOverlapping(..)
690691
| StatementKind::Assign(_)
691692
| StatementKind::SetDiscriminant { .. }
692693
| StatementKind::LlvmInlineAsm(_)

compiler/rustc_mir/src/transform/simplify.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ impl Visitor<'_> for UsedLocals {
428428
fn visit_statement(&mut self, statement: &Statement<'tcx>, location: Location) {
429429
match statement.kind {
430430
StatementKind::LlvmInlineAsm(..)
431+
| StatementKind::CopyNonOverlapping(..)
431432
| StatementKind::Retag(..)
432433
| StatementKind::Coverage(..)
433434
| StatementKind::FakeRead(..)

0 commit comments

Comments
 (0)