Skip to content

Commit

Permalink
Merge pull request #396 from tmandry/patch-1
Browse files Browse the repository at this point in the history
Copyedits to FFI and unwinding section
  • Loading branch information
ehuss authored Jan 18, 2023
2 parents 7d56a22 + d1a59f5 commit bd1829d
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/ffi.md
Original file line number Diff line number Diff line change
Expand Up @@ -721,17 +721,20 @@ No `transmute` required!
## FFI and unwinding
It’s important to be mindful of unwinding when working with FFI. Each
non-`Rust` ABI comes in two variants, one with `-unwind` suffix and one without. If
you expect Rust `panic`s or foreign (e.g. C++) exceptions to cross an FFI
boundary, that boundary must use the appropriate `-unwind` ABI string (note
that compiling with `panic=abort` will still cause `panic!` to immediately
abort the process, regardless of which ABI is specified by the function that
`panic`s).
It’s important to be mindful of unwinding when working with FFI. Most
ABI strings come in two variants, one with an `-unwind` suffix and one without.
The `Rust` ABI always permits unwinding, so there is no `Rust-unwind` ABI.
If you expect Rust `panic`s or foreign (e.g. C++) exceptions to cross an FFI
boundary, that boundary must use the appropriate `-unwind` ABI string.
Conversely, if you do not expect unwinding to cross an ABI boundary, use one of
the non-`unwind` ABI strings (other than `Rust`, which always permits
unwinding). If an unwinding operation does encounter an ABI boundary that is
the non-`unwind` ABI strings.
> Note: Compiling with `panic=abort` will still cause `panic!` to immediately
abort the process, regardless of which ABI is specified by the function that
`panic`s.
If an unwinding operation does encounter an ABI boundary that is
not permitted to unwind, the behavior depends on the source of the unwinding
(Rust `panic` or a foreign exception):
Expand Down

0 comments on commit bd1829d

Please sign in to comment.