-
Notifications
You must be signed in to change notification settings - Fork 13.3k
TRPL: FFI: address panics #26455
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
TRPL: FFI: address panics #26455
Conversation
# fn main() {} | ||
``` | ||
|
||
If you’re writing code that may panic, you should run it in an other thread, |
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.
s/an other/another
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.
fixed
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.
@bors r+ rollup
On Sat, Jun 20, 2015 at 11:19 AM, Steve Klabnik [email protected]
wrote:
In src/doc/trpl/ffi.md
#26455 (comment):@@ -530,3 +530,37 @@ The
extern
makes this function adhere to the C calling convention, as
discussed above in "Foreign Calling
Conventions". Theno_mangle
attribute turns off Rust's name mangling, so that it is easier to link to.
+
+# FFI and panics
+
+It’s important to be mindful ofpanic!
s when working with FFI. This code,
+when called from C, willabort
:
+
+```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 an other thread,
fixed
—
Reply to this email directly or view it on GitHub
https://github.com/rust-lang/rust/pull/26455/files#r32886642.
I'm not sure if this is in the scope or style or TRPL, but I think it would be worth noting that having to spawn a thread is a temporary measure while we work out our story here. |
yeah, the style is to just not mention anything unstable except in the
unstable section. Doing it any other way leads to rot...
|
@bors: r=gankro rollup |
📌 Commit 24c1e10 has been approved by |
⌛ Testing commit 24c1e10 with merge 1ec599c... |
Fixes #26443
r? @gankro