Skip to content

Commit d49c90c

Browse files
ehussBatmanAoD
authored andcommitted
Clarify optimization for abort strategy
At least as it is today, rustc doesn't look at the runtime, but instead the strategy (`-Cpanic`) of the current crate to elide landing pads and such when generating object code.
1 parent 2617cd5 commit d49c90c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/panic.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ The actual behavior and implementation of a panic is controlled by the _panic ru
2727
> [!NOTE]
2828
> The panic runtime can be chosen in `rustc` with the [`-C panic`] CLI flag when building any crate type except an rlib.
2929
30-
> [!NOTE]
31-
> When compiling code that is guaranteed to be linked to a non-recoverable panic runtime, the optimizer may assume that unwinding across Rust frames is impossible, which can result in both code-size and runtime speed improvements.
32-
3330
See also the [`panic_handler` attribute](runtime.md#the-panic_handler-attribute) which can be used to change the behavior of panics.
3431

3532
r[panic.strategy]
@@ -41,6 +38,9 @@ The _panic strategy_ defines the kind of panic runtime that a crate is built to
4138
> [!NOTE]
4239
> The panic strategy can be chosen in `rustc` with the [`-C panic`] CLI flag.
4340
41+
> [!NOTE]
42+
> When compiling code with a non-recoverable panic strategy, the optimizer may assume that unwinding across Rust frames is impossible, which can result in both code-size and runtime speed improvements.
43+
4444
r[panic.strategy.mixed]
4545
When linking with the `unwind` runtime, all crates must be built with the `unwind` strategy.
4646

0 commit comments

Comments
 (0)