Skip to content

Commit

Permalink
Rollup merge of #105998 - RalfJung:no-unwind-panic-msg, r=thomcc
Browse files Browse the repository at this point in the history
adjust message on non-unwinding panic

"thread panicked while panicking" is just plain wrong in case this is a non-unwinding panic, such as
- a panic out of a `nounwind` function
- the sanity checks we have in `mem::uninitialized` and `mem::zeroed`
- the optional debug assertion in various unsafe std library functions
  • Loading branch information
matthiaskrgr authored Dec 28, 2022
2 parents 0630677 + b804c0d commit d28ef9d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion library/std/src/panicking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,11 @@ fn rust_panic_with_hook(
// have limited options. Currently our preference is to
// just abort. In the future we may consider resuming
// unwinding or otherwise exiting the thread cleanly.
rtprintpanic!("thread panicked while panicking. aborting.\n");
if !can_unwind {
rtprintpanic!("thread caused non-unwinding panic. aborting.\n");
} else {
rtprintpanic!("thread panicked while panicking. aborting.\n");
}
crate::sys::abort_internal();
}

Expand Down

0 comments on commit d28ef9d

Please sign in to comment.