diff --git a/compiler/rustc_codegen_ssa/src/mir/statement.rs b/compiler/rustc_codegen_ssa/src/mir/statement.rs index 774c920ee96..054273262f7 100644 --- a/compiler/rustc_codegen_ssa/src/mir/statement.rs +++ b/compiler/rustc_codegen_ssa/src/mir/statement.rs @@ -126,8 +126,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { let count = count_val.immediate_or_packed_pair(&mut bx); let dst = dst_val.immediate_or_packed_pair(&mut bx); let src = src_val.immediate_or_packed_pair(&mut bx); - use crate::MemFlags; - let flags = MemFlags::empty(); + let flags = crate::MemFlags::empty(); bx.memcpy( dst, dst_val.layout.layout.align.pref, diff --git a/compiler/rustc_mir/src/borrow_check/invalidation.rs b/compiler/rustc_mir/src/borrow_check/invalidation.rs index 1f3dfc251e1..17c4f3c6494 100644 --- a/compiler/rustc_mir/src/borrow_check/invalidation.rs +++ b/compiler/rustc_mir/src/borrow_check/invalidation.rs @@ -100,12 +100,6 @@ impl<'cx, 'tcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx> { self.consume_operand(location, src); self.consume_operand(location, dst); self.consume_operand(location, count); - match dst { - Operand::Move(ref place) | Operand::Copy(ref place) => { - self.mutate_place(location, *place, Deep, JustWrite); - } - _ => {} - } } StatementKind::Nop | StatementKind::Coverage(..) diff --git a/compiler/rustc_mir/src/borrow_check/mod.rs b/compiler/rustc_mir/src/borrow_check/mod.rs index 539319ab9f2..037abb04f56 100644 --- a/compiler/rustc_mir/src/borrow_check/mod.rs +++ b/compiler/rustc_mir/src/borrow_check/mod.rs @@ -627,7 +627,15 @@ impl<'cx, 'tcx> dataflow::ResultsVisitor<'cx, 'tcx> for MirBorrowckCtxt<'cx, 'tc } } - StatementKind::CopyNonOverlapping(..) => todo!(), + StatementKind::CopyNonOverlapping(box rustc_middle::mir::CopyNonOverlapping { + src, + dst, + count, + }) => { + self.consume_operand(location, (src, span), flow_state); + self.consume_operand(location, (dst, span), flow_state); + self.consume_operand(location, (count, span), flow_state); + } StatementKind::Nop | StatementKind::Coverage(..) | StatementKind::AscribeUserType(..) diff --git a/compiler/rustc_mir/src/borrow_check/type_check/mod.rs b/compiler/rustc_mir/src/borrow_check/type_check/mod.rs index 74d7fd84c9e..58db2752c98 100644 --- a/compiler/rustc_mir/src/borrow_check/type_check/mod.rs +++ b/compiler/rustc_mir/src/borrow_check/type_check/mod.rs @@ -1520,7 +1520,41 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { ); } } - StatementKind::CopyNonOverlapping(..) => todo!(), + StatementKind::CopyNonOverlapping(box rustc_middle::mir::CopyNonOverlapping { + ref src, + ref dst, + ref count, + }) => { + let op_src_ty = self.normalize(src.ty(body, self.tcx()), location); + let op_dst_ty = self.normalize(dst.ty(body, self.tcx()), location); + // since CopyNonOverlapping is parametrized by 1 type, + // we only need to check that they are equal and not keep an extra parameter. + if let Err(terr) = self.eq_types( + op_src_ty, + op_dst_ty, + location.to_locations(), + ConstraintCategory::Internal, + ) { + span_mirbug!( + self, + stmt, + "bad arg ({:?} != {:?}): {:?}", + op_src_ty, + op_dst_ty, + terr + ); + } + + let op_cnt_ty = self.normalize(count.ty(body, self.tcx()), location); + if let Err(terr) = self.eq_types( + op_cnt_ty, + tcx.types.usize, + location.to_locations(), + ConstraintCategory::Internal, + ) { + span_mirbug!(self, stmt, "bad arg ({:?} != usize): {:?}", op_cnt_ty, terr); + } + } StatementKind::FakeRead(..) | StatementKind::StorageLive(..) | StatementKind::StorageDead(..)