-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix coroutine validation for mixed panic strategy
Validation introduced in #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
Showing
4 changed files
with
28 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// compile-flags: -Cpanic=unwind --crate-type=lib | ||
// no-prefer-dynamic | ||
// edition:2021 | ||
|
||
#![feature(coroutines)] | ||
pub fn run<T>(a: T) { | ||
let _ = move || { | ||
drop(a); | ||
yield; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Ensure that coroutine drop glue is valid when mixing different panic | ||
// strategies. Regression test for #116953. | ||
// | ||
// no-prefer-dynamic | ||
// build-pass | ||
// aux-build:unwind-aux.rs | ||
// compile-flags: -Cpanic=abort | ||
// needs-unwind | ||
extern crate unwind_aux; | ||
|
||
pub fn main() { | ||
unwind_aux::run(String::new()); | ||
} |