Skip to content

Commit

Permalink
Fix coroutine validation for mixed panic strategy
Browse files Browse the repository at this point in the history
Validation introduced in rust-lang#113124 allows UnwindAction::Continue and
TerminatorKind::Resume to occur only in functions with ABI that can
unwind. The function ABI depends on the panic strategy, which can vary
across crates.

Usually MIR is built and validated in the same crate. The coroutine drop
glue thus far was an exception. As a result validation could fail when
mixing different panic strategies.

Avoid the problem by executing AbortUnwindingCalls along with the
validation.
  • Loading branch information
tmiasko committed Nov 28, 2023
1 parent 5facb42 commit 5161b22
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 12 deletions.
10 changes: 0 additions & 10 deletions compiler/rustc_mir_transform/src/coroutine.rs
6 changes: 4 additions & 2 deletions compiler/rustc_mir_transform/src/shim.rs
11 changes: 11 additions & 0 deletions tests/ui/coroutine/auxiliary/unwind-aux.rs
13 changes: 13 additions & 0 deletions tests/ui/coroutine/unwind-abort-mix.rs

0 comments on commit 5161b22

Please sign in to comment.