From ee43c5e2f0d838de2721b8c5a30aa25d882398d9 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Fri, 3 Jul 2015 12:56:51 -0400 Subject: [PATCH] FFI panic is UB I incorrectly stated that it's an abort. --- src/doc/trpl/ffi.md | 17 ++++------------- 1 file 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;