Skip to content

Commit c85779c

Browse files
Handle SetDiscriminant when building MoveData
1 parent 5c65ab4 commit c85779c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/librustc_mir/dataflow/move_paths/builder.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -310,11 +310,10 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
310310
StatementKind::StorageDead(local) => {
311311
self.gather_move(Place::from(*local));
312312
}
313-
StatementKind::SetDiscriminant { .. } => {
314-
span_bug!(
315-
stmt.source_info.span,
316-
"SetDiscriminant should not exist during borrowck"
317-
);
313+
StatementKind::SetDiscriminant { place, .. } => {
314+
// `SetDiscriminant` should not exist during borrowck, but we need to handle
315+
// it here to compute what places are moved from during later compilation stages.
316+
self.create_move_path(**place);
318317
}
319318
StatementKind::Retag { .. }
320319
| StatementKind::AscribeUserType(..)

0 commit comments

Comments
 (0)