Description
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 topanic
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 Rustpanic
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.