Skip to content

Commit

Permalink
Swap inserts to keep the original ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-schievink committed Mar 14, 2020
1 parent cb58de8 commit 38fa378
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/librustc_mir/transform/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1099,17 +1099,17 @@ fn create_generator_resume_function<'tcx>(
// Panic when resumed on the returned or poisoned state
let generator_kind = body.generator_kind.unwrap();

if can_return {
if can_unwind {
cases.insert(
1,
(RETURNED, insert_panic_block(tcx, body, ResumedAfterReturn(generator_kind))),
(POISONED, insert_panic_block(tcx, body, ResumedAfterPanic(generator_kind))),
);
}

if can_unwind {
if can_return {
cases.insert(
1,
(POISONED, insert_panic_block(tcx, body, ResumedAfterPanic(generator_kind))),
(RETURNED, insert_panic_block(tcx, body, ResumedAfterReturn(generator_kind))),
);
}

Expand Down

0 comments on commit 38fa378

Please sign in to comment.