diff options
| author | Steve Klabnik <steve@steveklabnik.com> | 2015-07-06 18:06:29 -0400 |
|---|---|---|
| committer | Steve Klabnik <steve@steveklabnik.com> | 2015-07-06 18:06:29 -0400 |
| commit | aef38ef8190d492607e4ca2629e0ce5889db157e (patch) | |
| tree | 124902479126713e74907f95d02404ca33cbb5de | |
| parent | b959f256bf52e1fef23c197289693a67d373565f (diff) | |
| parent | ee43c5e2f0d838de2721b8c5a30aa25d882398d9 (diff) | |
| download | rust-aef38ef8190d492607e4ca2629e0ce5889db157e.tar.gz rust-aef38ef8190d492607e4ca2629e0ce5889db157e.zip | |
Rollup merge of #26761 - steveklabnik:actually_ub, r=alexcrichton
I incorrectly stated that it's an abort. r? @Gankro
| -rw-r--r-- | src/doc/trpl/ffi.md | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/src/doc/trpl/ffi.md b/src/doc/trpl/ffi.md index 442a1f062ef..cbedf863714 100644 --- a/src/doc/trpl/ffi.md +++ b/src/doc/trpl/ffi.md @@ -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; |
