-
Notifications
You must be signed in to change notification settings - Fork 505
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
Update guarantees of unwinding past an extern "C" function #887
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -174,12 +174,15 @@ extern "C" fn new_i32() -> i32 { 0 } | |
let fptr: extern "C" fn() -> i32 = new_i32; | ||
``` | ||
|
||
Functions with an ABI that differs from `"Rust"` do not support unwinding in the | ||
exact same way that Rust does. Therefore, unwinding past the end of functions | ||
with such ABIs causes the process to abort. | ||
Functions with an ABI that differs from `"Rust"` do not support unwinding in | ||
the exact same way that Rust does. Therefore, unwinding past the end of | ||
functions with such ABIs results in undefined behavior, and will differ between | ||
platforms and compiler editions. If you cannot guarantee this will not happen, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure what "compiler editions" means here. "Edition" has a specific meaning in Rust, and I don't think that is what is being referred to here. I think it would be fine to end the sentence at "undefined behavior", with the link leading the reader to understanding what that means. |
||
you should use [`catch_unwind`] or similar to abort the program instead if | ||
unwinding would pass through the function. | ||
|
||
> **Note**: The LLVM backend of the `rustc` implementation | ||
aborts the process by executing an illegal instruction. | ||
> **Note**: Currently, in nightly `rustc` the LLVM backend aborts the process | ||
> by executing an illegal instruction. However, this is not the behavior in stable. | ||
Comment on lines
+184
to
+185
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We generally don't include notes about specific versions of the rustc compiler in the reference. I'm also not sure what this is referring to, since it no longer aborts on unwind. |
||
|
||
## Const functions | ||
|
||
|
@@ -372,3 +375,4 @@ fn foo_oof(#[some_inert_attribute] arg: u8) { | |
[`link_section`]: ../abi.md#the-link_section-attribute | ||
[`no_mangle`]: ../abi.md#the-no_mangle-attribute | ||
[built-in attributes]: ../attributes.html#built-in-attributes-index | ||
[`catch_unwind`]: ../../std/panic/fn.catch_unwind.html |
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.
Can you link
undefined behavior
tobehavior-considered-undefined.md
?