Skip to content

Commit fe0260f

Browse files
committed
mir: Gather move at SwitchInt, Assert terminators
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
1 parent c83fa5d commit fe0260f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/librustc_mir/dataflow/move_paths/builder.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -353,9 +353,12 @@ impl<'b, 'a, 'gcx, 'tcx> Gatherer<'b, 'a, 'gcx, 'tcx> {
353353
self.gather_move(&Place::Local(RETURN_PLACE));
354354
}
355355

356-
TerminatorKind::Assert { .. } |
357-
TerminatorKind::SwitchInt { .. } => {
358-
// branching terminators - these don't move anything
356+
TerminatorKind::Assert { ref cond, .. } => {
357+
self.gather_operand(cond);
358+
}
359+
360+
TerminatorKind::SwitchInt { ref discr, .. } => {
361+
self.gather_operand(discr);
359362
}
360363

361364
TerminatorKind::Yield { ref value, .. } => {

0 commit comments

Comments
 (0)