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.
This commit is contained in:
kadmin 2021-01-23 00:23:13 +00:00
parent 982382dc03
commit 049045b100
4 changed files with 45 additions and 10 deletions

View File

@ -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,

View File

@ -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(..)

View File

@ -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(..)

View File

@ -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(..)