Skip to content

Commit

Permalink
mir: Gather move at SwitchInt, Assert terminators
Browse files Browse the repository at this point in the history
Previously, "_1" was not marked as "definitely uninitialized" after a "switchInt(move _1)" terminator.

Related discussion: https://internals.rust-lang.org/t/why-is-2-definitely-initialized-after-switchint-move-2/6760
  • Loading branch information
fpoli committed Feb 15, 2018
1 parent c83fa5d commit fe0260f
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 fe0260f

Please sign in to comment.