Skip to content

Commit

Permalink
Rollup merge of rust-lang#48232 - fpoli:master, r=pnkfelix
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Manishearth committed Feb 24, 2018
2 parents 111af8f + fe0260f commit 8fdad6f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/librustc_mir/dataflow/move_paths/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, .. } => {
Expand Down

0 comments on commit 8fdad6f

Please sign in to comment.