@@ -344,7 +344,7 @@ pub fn begin_panic_fmt(msg: &fmt::Arguments,
344344
345345 let mut s = String :: new ( ) ;
346346 let _ = s. write_fmt ( * msg) ;
347- begin_panic ( s , file_line_col)
347+ rust_panic_with_hook ( Box :: new ( s ) , Some ( msg ) , file_line_col)
348348}
349349
350350/// This is the entry point of panicking for panic!() and assert!().
@@ -360,7 +360,7 @@ pub fn begin_panic<M: Any + Send>(msg: M, file_line_col: &(&'static str, u32, u3
360360 // be performed in the parent of this thread instead of the thread that's
361361 // panicking.
362362
363- rust_panic_with_hook ( Box :: new ( msg) , file_line_col)
363+ rust_panic_with_hook ( Box :: new ( msg) , None , file_line_col)
364364}
365365
366366/// Executes the primary logic for a panic, including checking for recursive
@@ -371,7 +371,8 @@ pub fn begin_panic<M: Any + Send>(msg: M, file_line_col: &(&'static str, u32, u3
371371/// run panic hooks, and then delegate to the actual implementation of panics.
372372#[ inline( never) ]
373373#[ cold]
374- fn rust_panic_with_hook ( msg : Box < Any + Send > ,
374+ fn rust_panic_with_hook ( payload : Box < Any + Send > ,
375+ message : Option < & fmt:: Arguments > ,
375376 file_line_col : & ( & ' static str , u32 , u32 ) ) -> ! {
376377 let ( file, line, col) = * file_line_col;
377378
@@ -390,8 +391,8 @@ fn rust_panic_with_hook(msg: Box<Any + Send>,
390391
391392 unsafe {
392393 let info = PanicInfo :: internal_constructor (
393- & * msg ,
394- None ,
394+ & * payload ,
395+ message ,
395396 Location :: internal_constructor ( file, line, col) ,
396397 ) ;
397398 HOOK_LOCK . read ( ) ;
@@ -412,7 +413,7 @@ fn rust_panic_with_hook(msg: Box<Any + Send>,
412413 unsafe { intrinsics:: abort ( ) }
413414 }
414415
415- rust_panic ( msg )
416+ rust_panic ( payload )
416417}
417418
418419/// Shim around rust_panic. Called by resume_unwind.
0 commit comments