-
Notifications
You must be signed in to change notification settings - Fork 13.3k
FFI panic is UB #26761
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
FFI panic is UB #26761
Conversation
(lgtm but alex is the expert -- though I of course favour using Scare Caps for Undefined Behaviour) |
@@ -544,8 +545,8 @@ pub extern fn oh_no() -> ! { | |||
# fn main() {} | |||
``` | |||
|
|||
If you’re writing code that may panic, you should run it in another thread, | |||
so that the panic doesn’t bubble up to C: | |||
But it could do anything. If you’re writing code that may panic, you should run |
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 find this kinda confusing that this starts out by saying that the code could abort but then follows it up by saying it could do anything instead. Overall there's not a great thing we can say here without a stable catch_panic
. I think the core truth here is that unwinding just shouldn't cross FFI boundaries, and the way to do that is catch_panic
, once stabilized.
@alexcrichton updated |
I incorrectly stated that it's an abort.
…chton I incorrectly stated that it's an abort. r? @gankro
I incorrectly stated that it's an abort.
r? @gankro