@@ -316,16 +316,17 @@ pub fn begin_panic_fmt(msg: &fmt::Arguments<'_>,
316
316
unsafe { intrinsics:: abort ( ) }
317
317
}
318
318
319
+ // Just package everything into a `PanicInfo` and continue like libcore panics.
319
320
let ( file, line, col) = * file_line_col;
320
321
let location = Location :: internal_constructor ( file, line, col) ;
321
322
let info = PanicInfo :: internal_constructor ( Some ( msg) , & location) ;
322
- panic_handler ( & info)
323
+ begin_panic_handler ( & info)
323
324
}
324
325
325
- /// Entry point of panic from the libcore crate (`panic_impl` lang item).
326
+ /// Entry point of panics from the libcore crate (`panic_impl` lang item).
326
327
#[ cfg_attr( not( test) , panic_handler) ]
327
328
#[ unwind( allowed) ]
328
- fn panic_handler ( info : & PanicInfo < ' _ > ) -> ! {
329
+ pub fn begin_panic_handler ( info : & PanicInfo < ' _ > ) -> ! {
329
330
struct PanicPayload < ' a > {
330
331
inner : & ' a fmt:: Arguments < ' a > ,
331
332
string : Option < String > ,
@@ -374,7 +375,9 @@ fn panic_handler(info: &PanicInfo<'_>) -> ! {
374
375
& file_line_col) ;
375
376
}
376
377
377
- /// This is the entry point of panicking for panic!() and assert!().
378
+ /// This is the entry point of panicking for the non-format-string variants of
379
+ /// panic!() and assert!(). In particular, this is the only entry point that supports
380
+ /// arbitrary payloads, not just format strings.
378
381
#[ unstable( feature = "libstd_sys_internals" ,
379
382
reason = "used by the panic! macro" ,
380
383
issue = "0" ) ]
0 commit comments