@@ -12,7 +12,7 @@ use crate::panic::Location;
12
12
#[ stable( feature = "panic_hooks" , since = "1.10.0" ) ]
13
13
#[ derive( Debug ) ]
14
14
pub struct PanicInfo < ' a > {
15
- message : fmt:: Arguments < ' a > ,
15
+ message : & ' a fmt:: Arguments < ' a > ,
16
16
location : & ' a Location < ' a > ,
17
17
can_unwind : bool ,
18
18
force_no_backtrace : bool ,
@@ -26,13 +26,13 @@ pub struct PanicInfo<'a> {
26
26
/// See [`PanicInfo::message`].
27
27
#[ stable( feature = "panic_info_message" , since = "1.81.0" ) ]
28
28
pub struct PanicMessage < ' a > {
29
- message : fmt:: Arguments < ' a > ,
29
+ message : & ' a fmt:: Arguments < ' a > ,
30
30
}
31
31
32
32
impl < ' a > PanicInfo < ' a > {
33
33
#[ inline]
34
34
pub ( crate ) fn new (
35
- message : fmt:: Arguments < ' a > ,
35
+ message : & ' a fmt:: Arguments < ' a > ,
36
36
location : & ' a Location < ' a > ,
37
37
can_unwind : bool ,
38
38
force_no_backtrace : bool ,
@@ -146,7 +146,7 @@ impl Display for PanicInfo<'_> {
146
146
formatter. write_str ( "panicked at " ) ?;
147
147
self . location . fmt ( formatter) ?;
148
148
formatter. write_str ( ":\n " ) ?;
149
- formatter. write_fmt ( self . message ) ?;
149
+ formatter. write_fmt ( * self . message ) ?;
150
150
Ok ( ( ) )
151
151
}
152
152
}
@@ -177,14 +177,14 @@ impl<'a> PanicMessage<'a> {
177
177
impl Display for PanicMessage < ' _ > {
178
178
#[ inline]
179
179
fn fmt ( & self , formatter : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
180
- formatter. write_fmt ( self . message )
180
+ formatter. write_fmt ( * self . message )
181
181
}
182
182
}
183
183
184
184
#[ stable( feature = "panic_info_message" , since = "1.81.0" ) ]
185
185
impl fmt:: Debug for PanicMessage < ' _ > {
186
186
#[ inline]
187
187
fn fmt ( & self , formatter : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
188
- formatter. write_fmt ( self . message )
188
+ formatter. write_fmt ( * self . message )
189
189
}
190
190
}
0 commit comments