Update match branches
This updates all places where match branches check on StatementKind or UseContext. This doesn't properly implement them, but adds TODOs where they are, and also adds some best guesses to what they should be in some cases.
This commit is contained in:
parent
72c734d001
commit
89f45ed9f3
19 changed files with 1346 additions and 24 deletions
|
@ -92,6 +92,21 @@ impl<'cx, 'tcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx> {
|
|||
self.consume_operand(location, input);
|
||||
}
|
||||
}
|
||||
StatementKind::CopyNonOverlapping(box rustc_middle::mir::CopyNonOverlapping {
|
||||
ref src,
|
||||
ref dst,
|
||||
ref size,
|
||||
}) => {
|
||||
self.consume_operand(location, src);
|
||||
self.consume_operand(location, dst);
|
||||
self.consume_operand(location, size);
|
||||
match dst {
|
||||
Operand::Move(ref place) | Operand::Copy(ref place) => {
|
||||
self.mutate_place(location, *place, Deep, JustWrite);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
StatementKind::Nop
|
||||
| StatementKind::Coverage(..)
|
||||
| StatementKind::AscribeUserType(..)
|
||||
|
|
|
@ -626,6 +626,8 @@ impl<'cx, 'tcx> dataflow::ResultsVisitor<'cx, 'tcx> for MirBorrowckCtxt<'cx, 'tc
|
|||
self.consume_operand(location, (input, span), flow_state);
|
||||
}
|
||||
}
|
||||
|
||||
StatementKind::CopyNonOverlapping(..) => todo!(),
|
||||
StatementKind::Nop
|
||||
| StatementKind::Coverage(..)
|
||||
| StatementKind::AscribeUserType(..)
|
||||
|
|
|
@ -1520,6 +1520,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
|||
);
|
||||
}
|
||||
}
|
||||
StatementKind::CopyNonOverlapping(..) => todo!(),
|
||||
StatementKind::FakeRead(..)
|
||||
| StatementKind::StorageLive(..)
|
||||
| StatementKind::StorageDead(..)
|
||||
|
|
|
@ -306,6 +306,8 @@ impl<'tcx> dataflow::GenKillAnalysis<'tcx> for Borrows<'_, 'tcx> {
|
|||
| mir::StatementKind::AscribeUserType(..)
|
||||
| mir::StatementKind::Coverage(..)
|
||||
| mir::StatementKind::Nop => {}
|
||||
|
||||
mir::StatementKind::CopyNonOverlapping(..) => todo!(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -150,6 +150,8 @@ impl<'mir, 'tcx> dataflow::GenKillAnalysis<'tcx> for MaybeRequiresStorage<'mir,
|
|||
| StatementKind::Nop
|
||||
| StatementKind::Retag(..)
|
||||
| StatementKind::StorageLive(..) => {}
|
||||
|
||||
StatementKind::CopyNonOverlapping(..) => todo!(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -319,6 +319,8 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
|
|||
| StatementKind::AscribeUserType(..)
|
||||
| StatementKind::Coverage(..)
|
||||
| StatementKind::Nop => {}
|
||||
|
||||
StatementKind::CopyNonOverlapping(..) => todo!(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -113,6 +113,23 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||
M::retag(self, *kind, &dest)?;
|
||||
}
|
||||
|
||||
// Call CopyNonOverlapping
|
||||
CopyNonOverlapping(box rustc_middle::mir::CopyNonOverlapping { dst, src, size }) => {
|
||||
let size = self.eval_operand(size, None)?;
|
||||
|
||||
let dst = {
|
||||
let dst = self.eval_operand(dst, None)?;
|
||||
dst.assert_mem_place(self)
|
||||
};
|
||||
let src = {
|
||||
let src = self.eval_operand(src, None)?;
|
||||
src.assert_mem_place(self)
|
||||
};
|
||||
// Not sure how to convert an MPlaceTy<'_, <M as Machine<'_, '_>>::PointerTag>
|
||||
// to a pointer, or OpTy to a size
|
||||
self.memory.copy(src, dst, size, /*nonoverlapping*/ true)?;
|
||||
}
|
||||
|
||||
// Statements we do not track.
|
||||
AscribeUserType(..) => {}
|
||||
|
||||
|
|
|
@ -808,6 +808,7 @@ impl Visitor<'tcx> for Validator<'mir, 'tcx> {
|
|||
| StatementKind::Retag { .. }
|
||||
| StatementKind::AscribeUserType(..)
|
||||
| StatementKind::Coverage(..)
|
||||
| StatementKind::CopyNonOverlapping(..)
|
||||
| StatementKind::Nop => {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,6 +115,7 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> {
|
|||
| StatementKind::Retag { .. }
|
||||
| StatementKind::AscribeUserType(..)
|
||||
| StatementKind::Coverage(..)
|
||||
| StatementKind::CopyNonOverlapping(..)
|
||||
| StatementKind::Nop => {
|
||||
// safe (at least as emitted during MIR construction)
|
||||
}
|
||||
|
|
|
@ -587,6 +587,7 @@ impl Conflicts<'a> {
|
|||
| StatementKind::FakeRead(..)
|
||||
| StatementKind::AscribeUserType(..)
|
||||
| StatementKind::Coverage(..)
|
||||
| StatementKind::CopyNonOverlapping(..)
|
||||
| StatementKind::Nop => {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1454,6 +1454,7 @@ impl Visitor<'tcx> for EnsureGeneratorFieldAssignmentsNeverAlias<'_> {
|
|||
| StatementKind::Retag(..)
|
||||
| StatementKind::AscribeUserType(..)
|
||||
| StatementKind::Coverage(..)
|
||||
| StatementKind::CopyNonOverlapping(..)
|
||||
| StatementKind::Nop => {}
|
||||
}
|
||||
}
|
||||
|
|
1272
compiler/rustc_mir/src/transform/instrument_coverage.rs
Normal file
1272
compiler/rustc_mir/src/transform/instrument_coverage.rs
Normal file
File diff suppressed because it is too large
Load diff
|
@ -39,6 +39,7 @@ impl RemoveNoopLandingPads {
|
|||
| StatementKind::StorageDead(_)
|
||||
| StatementKind::AscribeUserType(..)
|
||||
| StatementKind::Coverage(..)
|
||||
| StatementKind::CopyNonOverlapping(..)
|
||||
| StatementKind::Nop => {
|
||||
// These are all nops in a landing pad
|
||||
}
|
||||
|
|
|
@ -245,6 +245,7 @@ pub fn statement_kind_name(statement: &Statement<'_>) -> &'static str {
|
|||
Retag(..) => "Retag",
|
||||
AscribeUserType(..) => "AscribeUserType",
|
||||
Coverage(..) => "Coverage",
|
||||
CopyNonOverlapping(..) => "CopyNonOverlapping",
|
||||
Nop => "Nop",
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue