From d1b2d29528b7794b41e66fc2136e395a02f8529b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 05:59:35 +0200 Subject: Merging upstream version 1.73.0+dfsg1. Signed-off-by: Daniel Baumann --- library/core/src/panic/panic_info.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'library/core/src/panic/panic_info.rs') diff --git a/library/core/src/panic/panic_info.rs b/library/core/src/panic/panic_info.rs index 5576adde8..c7f04f11e 100644 --- a/library/core/src/panic/panic_info.rs +++ b/library/core/src/panic/panic_info.rs @@ -147,16 +147,18 @@ impl<'a> PanicInfo<'a> { impl fmt::Display for PanicInfo<'_> { fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { formatter.write_str("panicked at ")?; + self.location.fmt(formatter)?; if let Some(message) = self.message { - write!(formatter, "'{}', ", message)? + formatter.write_str(":\n")?; + formatter.write_fmt(*message)?; } else if let Some(payload) = self.payload.downcast_ref::<&'static str>() { - write!(formatter, "'{}', ", payload)? + formatter.write_str(":\n")?; + formatter.write_str(payload)?; } // NOTE: we cannot use downcast_ref::() here // since String is not available in core! // The payload is a String when `std::panic!` is called with multiple arguments, // but in that case the message is also available. - - self.location.fmt(formatter) + Ok(()) } } -- cgit v1.2.3