Rollup merge of #48232 - fpoli:master, r=pnkfelix

mir: Gather move at SwitchInt, Assert terminators

Previously, `_1` was not marked as "definitely uninitialized" after a `switchInt(move _1)` terminator.

I think the same goes for the `assert` terminator.

Related discussion: https://internals.rust-lang.org/t/why-is-2-definitely-initialized-after-switchint-move-2/6760
This commit is contained in:
Manish Goregaokar 2018-02-24 08:55:46 -08:00
commit 8fdad6f2ef

View File

@ -353,9 +353,12 @@ impl<'b, 'a, 'gcx, 'tcx> Gatherer<'b, 'a, 'gcx, 'tcx> {
self.gather_move(&Place::Local(RETURN_PLACE));
}
TerminatorKind::Assert { .. } |
TerminatorKind::SwitchInt { .. } => {
// branching terminators - these don't move anything
TerminatorKind::Assert { ref cond, .. } => {
self.gather_operand(cond);
}
TerminatorKind::SwitchInt { ref discr, .. } => {
self.gather_operand(discr);
}
TerminatorKind::Yield { ref value, .. } => {