diff options
| author | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2023-03-08 00:00:00 +0000 |
|---|---|---|
| committer | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2023-03-08 22:32:15 +0100 |
| commit | 7c75e39790a6cfd5f4f8e90a2554286d3d9eabea (patch) | |
| tree | 6617c02cbcbe994c93bd877559fe8a58b6d0b2a7 | |
| parent | 7c306f6dcd600b1fcc74439c780e8ebef338d84c (diff) | |
| download | rust-7c75e39790a6cfd5f4f8e90a2554286d3d9eabea.tar.gz rust-7c75e39790a6cfd5f4f8e90a2554286d3d9eabea.zip | |
panic_immediate_abort requires abort as a panic strategy
Guide `panic_immediate_abort` users away from `-Cpanic=unwind` and towards `-Cpanic=abort` to avoid an accidental use of the feature with the unwind strategy, e.g., on a targets where unwind is the default. The `-Cpanic=unwind` combination doesn't offer the same benefits, since the code would still be generated under the assumption that functions implemented in Rust can unwind.
| -rw-r--r-- | library/core/src/panicking.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/library/core/src/panicking.rs b/library/core/src/panicking.rs index 805a1e51ae9..7e7a9cbe4a6 100644 --- a/library/core/src/panicking.rs +++ b/library/core/src/panicking.rs @@ -29,6 +29,9 @@ use crate::fmt; use crate::panic::{Location, PanicInfo}; +#[cfg(feature = "panic_immediate_abort")] +const _: () = assert!(cfg!(panic = "abort"), "panic_immediate_abort requires -C panic=abort"); + // First we define the two main entry points that all panics go through. // In the end both are just convenience wrappers around `panic_impl`. |
