Skip to content

Commit 38fa378

Browse files
Swap inserts to keep the original ordering
1 parent cb58de8 commit 38fa378

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/librustc_mir/transform/generator.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1099,17 +1099,17 @@ fn create_generator_resume_function<'tcx>(
10991099
// Panic when resumed on the returned or poisoned state
11001100
let generator_kind = body.generator_kind.unwrap();
11011101

1102-
if can_return {
1102+
if can_unwind {
11031103
cases.insert(
11041104
1,
1105-
(RETURNED, insert_panic_block(tcx, body, ResumedAfterReturn(generator_kind))),
1105+
(POISONED, insert_panic_block(tcx, body, ResumedAfterPanic(generator_kind))),
11061106
);
11071107
}
11081108

1109-
if can_unwind {
1109+
if can_return {
11101110
cases.insert(
11111111
1,
1112-
(POISONED, insert_panic_block(tcx, body, ResumedAfterPanic(generator_kind))),
1112+
(RETURNED, insert_panic_block(tcx, body, ResumedAfterReturn(generator_kind))),
11131113
);
11141114
}
11151115

0 commit comments

Comments
 (0)