Skip to content

Commit

Permalink
Rollup merge of #108924 - tmiasko:panic-immediate-abort, r=thomcc
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
matthiaskrgr authored Mar 24, 2023
2 parents eb46afb + 7c75e39 commit d9c05b8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions library/core/src/panicking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down

0 comments on commit d9c05b8

Please sign in to comment.