Skip to content

Commit ccc486d

Browse files
Kyle StrandBatmanAoD
authored andcommitted
PR suggestions
1 parent 6ad5764 commit ccc486d

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

src/behavior-considered-undefined.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ code.
5454
* Calling a function with the wrong call ABI or unwinding from a function with the wrong unwind ABI.
5555
* Calling a foreign (e.g. C++) function that unwinds (`throw`s) via a function
5656
declaration or pointer declared with a non-unwinding ABI such as `"C"`
57+
* Deallocating a Rust stack frame without executing destructors
58+
for local variables owned by the stack frame. This can occur
59+
with C functions like `longjmp`.
5760
* Producing an invalid value, even in private fields and locals. "Producing" a
5861
value happens any time a value is assigned to or read from a place, passed to
5962
a function/primitive operation or returned from a function/primitive

src/items/functions.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,12 @@ The choice of ABI, together with the [panic mode][panic-modes], determines the
211211
behavior when unwinding out of a function.
212212

213213
In the table below, "Unforced foreign unwind" refers to something like a C++
214-
exception; the table indicates the behavior when entering a Rust stackframe via
215-
an function or function pointer declared with the specified ABI string.
216-
Additionally, `C` in the ABI strings may be substituted with `stdcall` or any
217-
other ABI supported by the language implementation.
214+
exception; the table indicates the behavior of an unwinding
215+
operation reaching each type of ABI boundary (function
216+
declaration or definition using the corresponding ABI string).
217+
Additionally, `C` in the ABI strings may be substituted with
218+
`stdcall` or any other ABI supported by the language
219+
implementation.
218220

219221
| panic runtime | ABI | `panic`-unwind | Unforced foreign unwind |
220222
| -------------- | ------------ | ------------------------------------- | ----------------------- |

src/linkage.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,14 @@ both of the following characteristics:
219219
* It contains a call to an `-unwind` foreign function or function pointer
220220
* It was compiled with `panic=unwind`
221221

222+
`rustc` enforces this restriction at link-time. To guarantee that
223+
a library will be linkable regardless of the panic mode used at
224+
link-time, the `ffi_unwind_calls` may be used. The lint flags any
225+
calls to `-unwind` foreign functions or function pointers.
226+
222227
Note: Cargo will automatically unify all crates to use the same `panic`
223228
runtime, so this prohibition does not apply to projects compiled with Cargo.
224229

225-
<!-- TODO: edit the above to indicate that this prohibition is enforced by
226-
`rustc` once https://github.com/rust-lang/rust/pull/97235 has been merged -->
227-
228230
[`cfg` attribute `target_feature` option]: conditional-compilation.md#target_feature
229231
[configuration option]: conditional-compilation.md
230232
[procedural macros]: procedural-macros.md

0 commit comments

Comments
 (0)