-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Tracking Issue for abort_unwind
#130338
Comments
Does this not imply we should have |
As was mentioned on the ACP, it would indeed be unfortunate if |
Add `core::panic::abort_unwind` `abort_unwind` is like `catch_unwind` except that it aborts the process if it unwinds, using the `#[rustc_nounwind]` mechanism also used by `extern "C" fn` to abort unwinding. The docs attempt to make it clear when to (rarely) and when not to (usually) use the function. Although usage of the function is discouraged, having it available will help to normalize the experience when abort_unwind shims are hit, as opposed to the current ecosystem where there exist multiple common patterns for converting unwinding into a process abort. For further information and justification, see the linked ACP. - Tracking issue: rust-lang#130338 - ACP: rust-lang/libs-team#441
Bikeshed: I think |
fn abort_unwind(payload: Box<dyn Any + Send>) {
abort_on_unwind(|| drop(payload))
// or aborts with "unwind in cleanup"
} for handling the I'm mostly ambivalent on this matter and the implementation PR is approved already, so I'll leave the name to let libs-api stew on it for now. |
Rollup merge of rust-lang#130339 - CAD97:unwind-choice, r=dtolnay Add `core::panic::abort_unwind` `abort_unwind` is like `catch_unwind` except that it aborts the process if it unwinds, using the `#[rustc_nounwind]` mechanism also used by `extern "C" fn` to abort unwinding. The docs attempt to make it clear when to (rarely) and when not to (usually) use the function. Although usage of the function is discouraged, having it available will help to normalize the experience when abort_unwind shims are hit, as opposed to the current ecosystem where there exist multiple common patterns for converting unwinding into a process abort. For further information and justification, see the linked ACP. - Tracking issue: rust-lang#130338 - ACP: rust-lang/libs-team#441
I agree the name is confusing, I first thought this would abort unwinding (e.g., being in the same category as |
add test for new abort_unwind function Seems like a good thing to have an explicit test for. Cc rust-lang/rust#130338
add test for new abort_unwind function Seems like a good thing to have an explicit test for. Cc rust-lang#130338
Feature gate:
#![feature(abort_unwind)]
This is a tracking issue for
core::panic::abort_unwind
.abort_unwind
is similar tocatch_unwind
, except that it aborts the process if it unwinds instead of catching the unwind. Prior to the abort, the panic hook is called in the same way that it is for other functions that cannot unwind (e.g.extern "C" fn
).Public API
Steps / History
core::panic::abort_unwind
#130339abort_on_unwind
)?fn abort() -> !
incore
?Unresolved Questions
Footnotes
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩
The text was updated successfully, but these errors were encountered: