@@ -12,7 +12,7 @@ use crate::panic::Location;
1212#[ stable( feature = "panic_hooks" , since = "1.10.0" ) ]
1313#[ derive( Debug ) ]
1414pub struct PanicInfo < ' a > {
15- message : fmt:: Arguments < ' a > ,
15+ message : & ' a fmt:: Arguments < ' a > ,
1616 location : & ' a Location < ' a > ,
1717 can_unwind : bool ,
1818 force_no_backtrace : bool ,
@@ -26,13 +26,13 @@ pub struct PanicInfo<'a> {
2626/// See [`PanicInfo::message`].
2727#[ stable( feature = "panic_info_message" , since = "1.81.0" ) ]
2828pub struct PanicMessage < ' a > {
29- message : fmt:: Arguments < ' a > ,
29+ message : & ' a fmt:: Arguments < ' a > ,
3030}
3131
3232impl < ' a > PanicInfo < ' a > {
3333 #[ inline]
3434 pub ( crate ) fn new (
35- message : fmt:: Arguments < ' a > ,
35+ message : & ' a fmt:: Arguments < ' a > ,
3636 location : & ' a Location < ' a > ,
3737 can_unwind : bool ,
3838 force_no_backtrace : bool ,
@@ -146,7 +146,7 @@ impl Display for PanicInfo<'_> {
146146 formatter. write_str ( "panicked at " ) ?;
147147 self . location . fmt ( formatter) ?;
148148 formatter. write_str ( ":\n " ) ?;
149- formatter. write_fmt ( self . message ) ?;
149+ formatter. write_fmt ( * self . message ) ?;
150150 Ok ( ( ) )
151151 }
152152}
@@ -177,14 +177,14 @@ impl<'a> PanicMessage<'a> {
177177impl Display for PanicMessage < ' _ > {
178178 #[ inline]
179179 fn fmt ( & self , formatter : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
180- formatter. write_fmt ( self . message )
180+ formatter. write_fmt ( * self . message )
181181 }
182182}
183183
184184#[ stable( feature = "panic_info_message" , since = "1.81.0" ) ]
185185impl fmt:: Debug for PanicMessage < ' _ > {
186186 #[ inline]
187187 fn fmt ( & self , formatter : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
188- formatter. write_fmt ( self . message )
188+ formatter. write_fmt ( * self . message )
189189 }
190190}
0 commit comments