From 94bb6a629bd66af48c5c9cd20406f27aab0334e7 Mon Sep 17 00:00:00 2001 From: Tyler Mandry Date: Fri, 13 Jan 2023 21:07:10 -0500 Subject: [PATCH 1/2] Copyedits to FFI and unwinding section These are minor changes that make the text flow better to me. --- src/ffi.md | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/ffi.md b/src/ffi.md index 8d1a882..853009b 100644 --- a/src/ffi.md +++ b/src/ffi.md @@ -722,16 +722,19 @@ 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). +ABI comes in two variants, one with `-unwind` suffix and one without (except +the `Rust` ABI, which always permits unwinding). +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): From d1a59f543e6f7a5469b4a15d8122b0cdd05434a0 Mon Sep 17 00:00:00 2001 From: Kyle J Strand Date: Mon, 16 Jan 2023 19:31:31 -0700 Subject: [PATCH 2/2] Re-word: only "most" ABIs have `-unwind` --- src/ffi.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ffi.md b/src/ffi.md index 853009b..684e712 100644 --- a/src/ffi.md +++ b/src/ffi.md @@ -721,9 +721,9 @@ No `transmute` required! ## FFI and unwinding -It’s important to be mindful of unwinding when working with FFI. Each -ABI comes in two variants, one with `-unwind` suffix and one without (except -the `Rust` ABI, which always permits unwinding). +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.