Skip to content

Commit d9c05b8

Browse files
authored
Rollup merge of #108924 - tmiasko:panic-immediate-abort, r=thomcc
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.
2 parents eb46afb + 7c75e39 commit d9c05b8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

library/core/src/panicking.rs

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
use crate::fmt;
3030
use crate::panic::{Location, PanicInfo};
3131

32+
#[cfg(feature = "panic_immediate_abort")]
33+
const _: () = assert!(cfg!(panic = "abort"), "panic_immediate_abort requires -C panic=abort");
34+
3235
// First we define the two main entry points that all panics go through.
3336
// In the end both are just convenience wrappers around `panic_impl`.
3437

0 commit comments

Comments
 (0)