Rollup merge of #26761 - steveklabnik:actually_ub, r=alexcrichton
I incorrectly stated that it's an abort. r? @Gankro
This commit is contained in:
commit
aef38ef819
@ -533,19 +533,10 @@ attribute turns off Rust's name mangling, so that it is easier to link to.
|
||||
|
||||
# FFI and panics
|
||||
|
||||
It’s important to be mindful of `panic!`s when working with FFI. This code,
|
||||
when called from C, will `abort`:
|
||||
|
||||
```rust
|
||||
#[no_mangle]
|
||||
pub extern fn oh_no() -> ! {
|
||||
panic!("Oops!");
|
||||
}
|
||||
# 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:
|
||||
It’s important to be mindful of `panic!`s when working with FFI. A `panic!`
|
||||
across an FFI boundary is undefined behavior. 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:
|
||||
|
||||
```rust
|
||||
use std::thread;
|
||||
|
Loading…
x
Reference in New Issue
Block a user