-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix coroutine validation for mixed panic strategy #118422
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that generator drop shims will inherit the panic strategy of the crate that they're being monomorphized in, rather than the crate that they're coming from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
One could also try to move everything in other direction. That is, move validation from shim building to state transform, but unfortunately this introduces query cycle at the moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh. Do you know whether other shims default to definition-crate or mono-crate for their panic strategy? This inconsistency seems important to iron out, I feel? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To place this into context. While the mixed builds are allowed, the final strategy in that case is abort. The motivating use case being the standard library pre-built with unwind strategy, where the end user selects between unwind and abort.
The other shims, like the one here, are constructed using the strategy of the crate that requests the MIR. Usually, MIR would be requested at the monomorphization time, but it is an implementation detail, given that optimization like MIR inlining can request it earlier.
Any differences here should be at best quality of implementation kind.