Skip to content
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

Mention -unwind ABI variants #3729

Open
BatmanAoD opened this issue Aug 26, 2023 · 0 comments
Open

Mention -unwind ABI variants #3729

BatmanAoD opened this issue Aug 26, 2023 · 0 comments

Comments

@BatmanAoD
Copy link
Member

BatmanAoD commented Aug 26, 2023

As of Rust 1.71, every ABI except for Rust comes in two variants, an -unwind version and the original non-unwind version. This isn't something the book should cover in detail, but it seems reasonable to mention briefly.

The most appropriate place is probably Chapter 19, towards the end of "Using extern Functions to Call External Code". I'm not entirely sure whether it deserves a full paragraph or even its own inset, but here's some draft verbiage:

There are also ABI strings with -unwind, such as "C-unwind". The "unwind" in these strings refers to panic in Rust and to exceptions in C++. It is usually correct to use the standard, non-unwind version of an ABI string, which will cause the program to immediately exit with an error rather than letting a Rust panic or C++ exception "escape" from one language runtime to the other. Unwinding across language boundaries is hazardous and generally not a good way to expose errors in a cross-language API. If you do need to unwind across an FFI boundary, refer to the Reference or the Nomicon to learn how to do so safely.

If that's too much detail/information, it could be further shortened to:

There are also ABI strings with -unwind, such as "C-unwind". It is usually correct to use the standard, non-unwind version of an ABI string, but if you do need to unwind across an FFI boundary, refer to the Reference or the Nomicon to learn how to do so safely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants