diff options
| author | StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> | 2024-08-24 02:20:36 +0300 |
|---|---|---|
| committer | StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> | 2024-08-24 02:20:36 +0300 |
| commit | c2fdb3435fea8d30ef059dffd48332a537274005 (patch) | |
| tree | 5a3b376fac271c9025afcdffb885ba6d4b061902 /library/core/src/panic | |
| parent | eef00c8be8d92478e181011f24946cca3d468f0a (diff) | |
| download | rust-c2fdb3435fea8d30ef059dffd48332a537274005.tar.gz rust-c2fdb3435fea8d30ef059dffd48332a537274005.zip | |
Pass `fmt::Arguments` by reference to `PanicInfo` and `PanicMessage`
Diffstat (limited to 'library/core/src/panic')
| -rw-r--r-- | library/core/src/panic/panic_info.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/library/core/src/panic/panic_info.rs b/library/core/src/panic/panic_info.rs index e4d0c897b65..af2c83b5460 100644 --- a/library/core/src/panic/panic_info.rs +++ b/library/core/src/panic/panic_info.rs @@ -12,7 +12,7 @@ use crate::panic::Location; #[stable(feature = "panic_hooks", since = "1.10.0")] #[derive(Debug)] pub struct PanicInfo<'a> { - message: fmt::Arguments<'a>, + message: &'a fmt::Arguments<'a>, location: &'a Location<'a>, can_unwind: bool, force_no_backtrace: bool, @@ -26,13 +26,13 @@ pub struct PanicInfo<'a> { /// See [`PanicInfo::message`]. #[stable(feature = "panic_info_message", since = "1.81.0")] pub struct PanicMessage<'a> { - message: fmt::Arguments<'a>, + message: &'a fmt::Arguments<'a>, } impl<'a> PanicInfo<'a> { #[inline] pub(crate) fn new( - message: fmt::Arguments<'a>, + message: &'a fmt::Arguments<'a>, location: &'a Location<'a>, can_unwind: bool, force_no_backtrace: bool, @@ -146,7 +146,7 @@ impl Display for PanicInfo<'_> { formatter.write_str("panicked at ")?; self.location.fmt(formatter)?; formatter.write_str(":\n")?; - formatter.write_fmt(self.message)?; + formatter.write_fmt(*self.message)?; Ok(()) } } @@ -177,7 +177,7 @@ impl<'a> PanicMessage<'a> { impl Display for PanicMessage<'_> { #[inline] fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { - formatter.write_fmt(self.message) + formatter.write_fmt(*self.message) } } @@ -185,6 +185,6 @@ impl Display for PanicMessage<'_> { impl fmt::Debug for PanicMessage<'_> { #[inline] fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { - formatter.write_fmt(self.message) + formatter.write_fmt(*self.message) } } |
