diff options
Diffstat (limited to 'library/std/src/panicking.rs')
-rw-r--r-- | library/std/src/panicking.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/library/std/src/panicking.rs b/library/std/src/panicking.rs index a6a370409..a0c21f704 100644 --- a/library/std/src/panicking.rs +++ b/library/std/src/panicking.rs @@ -234,6 +234,7 @@ where *hook = Hook::Custom(Box::new(move |info| hook_fn(&prev, info))); } +/// The default panic handler. fn default_hook(info: &PanicInfo<'_>) { // If this is a double panic, make sure that we print a backtrace // for this panic. Otherwise only print it if logging is enabled. @@ -257,7 +258,7 @@ fn default_hook(info: &PanicInfo<'_>) { let name = thread.as_ref().and_then(|t| t.name()).unwrap_or("<unnamed>"); let write = |err: &mut dyn crate::io::Write| { - let _ = writeln!(err, "thread '{name}' panicked at '{msg}', {location}"); + let _ = writeln!(err, "thread '{name}' panicked at {location}:\n{msg}"); static FIRST_PANIC: AtomicBool = AtomicBool::new(true); @@ -272,7 +273,8 @@ fn default_hook(info: &PanicInfo<'_>) { if FIRST_PANIC.swap(false, Ordering::SeqCst) { let _ = writeln!( err, - "note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace" + "note: run with `RUST_BACKTRACE=1` environment variable to display a \ + backtrace" ); } } |