Skip to content

Commit 049045b

Browse files
committed
Replace todos with impls
Changed to various implementations, copying the style of prior function calls in places I was unsure of. Also one minor style nit.
1 parent 982382d commit 049045b

File tree

4 files changed

+45
-10
lines changed

4 files changed

+45
-10
lines changed

compiler/rustc_codegen_ssa/src/mir/statement.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
126126
let count = count_val.immediate_or_packed_pair(&mut bx);
127127
let dst = dst_val.immediate_or_packed_pair(&mut bx);
128128
let src = src_val.immediate_or_packed_pair(&mut bx);
129-
use crate::MemFlags;
130-
let flags = MemFlags::empty();
129+
let flags = crate::MemFlags::empty();
131130
bx.memcpy(
132131
dst,
133132
dst_val.layout.layout.align.pref,

compiler/rustc_mir/src/borrow_check/invalidation.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,6 @@ impl<'cx, 'tcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx> {
100100
self.consume_operand(location, src);
101101
self.consume_operand(location, dst);
102102
self.consume_operand(location, count);
103-
match dst {
104-
Operand::Move(ref place) | Operand::Copy(ref place) => {
105-
self.mutate_place(location, *place, Deep, JustWrite);
106-
}
107-
_ => {}
108-
}
109103
}
110104
StatementKind::Nop
111105
| StatementKind::Coverage(..)

compiler/rustc_mir/src/borrow_check/mod.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,15 @@ impl<'cx, 'tcx> dataflow::ResultsVisitor<'cx, 'tcx> for MirBorrowckCtxt<'cx, 'tc
627627
}
628628
}
629629

630-
StatementKind::CopyNonOverlapping(..) => todo!(),
630+
StatementKind::CopyNonOverlapping(box rustc_middle::mir::CopyNonOverlapping {
631+
src,
632+
dst,
633+
count,
634+
}) => {
635+
self.consume_operand(location, (src, span), flow_state);
636+
self.consume_operand(location, (dst, span), flow_state);
637+
self.consume_operand(location, (count, span), flow_state);
638+
}
631639
StatementKind::Nop
632640
| StatementKind::Coverage(..)
633641
| StatementKind::AscribeUserType(..)

compiler/rustc_mir/src/borrow_check/type_check/mod.rs

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1520,7 +1520,41 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
15201520
);
15211521
}
15221522
}
1523-
StatementKind::CopyNonOverlapping(..) => todo!(),
1523+
StatementKind::CopyNonOverlapping(box rustc_middle::mir::CopyNonOverlapping {
1524+
ref src,
1525+
ref dst,
1526+
ref count,
1527+
}) => {
1528+
let op_src_ty = self.normalize(src.ty(body, self.tcx()), location);
1529+
let op_dst_ty = self.normalize(dst.ty(body, self.tcx()), location);
1530+
// since CopyNonOverlapping is parametrized by 1 type,
1531+
// we only need to check that they are equal and not keep an extra parameter.
1532+
if let Err(terr) = self.eq_types(
1533+
op_src_ty,
1534+
op_dst_ty,
1535+
location.to_locations(),
1536+
ConstraintCategory::Internal,
1537+
) {
1538+
span_mirbug!(
1539+
self,
1540+
stmt,
1541+
"bad arg ({:?} != {:?}): {:?}",
1542+
op_src_ty,
1543+
op_dst_ty,
1544+
terr
1545+
);
1546+
}
1547+
1548+
let op_cnt_ty = self.normalize(count.ty(body, self.tcx()), location);
1549+
if let Err(terr) = self.eq_types(
1550+
op_cnt_ty,
1551+
tcx.types.usize,
1552+
location.to_locations(),
1553+
ConstraintCategory::Internal,
1554+
) {
1555+
span_mirbug!(self, stmt, "bad arg ({:?} != usize): {:?}", op_cnt_ty, terr);
1556+
}
1557+
}
15241558
StatementKind::FakeRead(..)
15251559
| StatementKind::StorageLive(..)
15261560
| StatementKind::StorageDead(..)

0 commit comments

Comments
 (0)