summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-12-28 22:22:21 +0100
committerGitHub <noreply@github.com>2022-12-28 22:22:21 +0100
commitd28ef9dbf1e9bedd0a30ad96ead65d95aaa09ebb (patch)
treee89d087e56c18320949d77252bc58c1c2c70cba2
parent06306770f83404fe5f73658d3e041768ec5736af (diff)
parentb804c0d5a54dee10a59fc2b3d54037cb96fbb598 (diff)
downloadrust-d28ef9dbf1e9bedd0a30ad96ead65d95aaa09ebb.tar.gz
rust-d28ef9dbf1e9bedd0a30ad96ead65d95aaa09ebb.zip
Rollup merge of #105998 - RalfJung:no-unwind-panic-msg, r=thomcc
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
-rw-r--r--library/std/src/panicking.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/library/std/src/panicking.rs b/library/std/src/panicking.rs
index 1039835bbbd..49c2f81403a 100644
--- a/library/std/src/panicking.rs
+++ b/library/std/src/panicking.rs
@@ -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();
     }