-
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
Mark the panic_no_unwind lang item as nounwind #93489
Conversation
r? @lcnr (rust-highfive has picked a reviewer for you, use r? to override) |
cc @nbdd0121 |
r? @nagisa maybe don't know enough here |
// unwind. If the panic handler that it invokes unwind then it will simply | ||
// call the panic handler again. | ||
if Some(id) == tcx.lang_items().panic_no_unwind() { | ||
codegen_fn_attrs.flags |= CodegenFnAttrFlags::NEVER_UNWIND; |
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.
Could we use #[rustc_allocator_nounwind]
instead? There's nothing allocator-specific for that attribute even though it has allocator in its name.
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.
If we did this, I would suggest renaming the attribute.
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.
I agree that this should be an attribute (or possibly a extern "Rust-nounwind"
ABI?). I've been away this past week and haven't had time to implement this yet, but it is on my TODO list.
@bors r+ I think its okay if we rely on language items to figure out what attributes we want to add to specific ones since we do that already quite pervasively. I can see us using a dedicated attribute once we have one. Right now what we have is pretty arbitrarily scoped to specific component of the standard library and I'm not entirely sure its a responsibility of this PR to adapt it to be more general. @Amanieu your description mentions soundness improvements. Do you think this is something that should appear in the relnotes? |
📌 Commit f738669 has been approved by |
This is only reachable with nounwind functions ( |
…askrgr Rollup of 2 pull requests Successful merges: - rust-lang#90998 (Require const stability attribute on all stable functions that are `const`) - rust-lang#93489 (Mark the panic_no_unwind lang item as nounwind) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This has 2 effects:
panic_no_unwind
.PanicInfo::can_unwind
returns true. This will simply cause another panic once the unwind tries to go past thepanic_no_unwind
lang item. Eventually this will cause a stack overflow, which is safe.