File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed
compiler/rustc_driver_impl/src Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -1390,8 +1390,25 @@ pub fn install_ice_hook(bug_report_url: &'static str, extra_info: fn(&Handler))
13901390 && let Ok ( mut out) =
13911391 File :: options( ) . create( true ) . append( true ) . open( & ice_path)
13921392 {
1393- let _ =
1394- write!( & mut out, "{info}{:#}" , std:: backtrace:: Backtrace :: force_capture( ) ) ;
1393+ // The current implementation always returns `Some`.
1394+ let location = info. location( ) . unwrap( ) ;
1395+ let msg = match info. payload( ) . downcast_ref:: <& ' static str >( ) {
1396+ Some ( s) => * s,
1397+ None => match info. payload( ) . downcast_ref:: <String >( ) {
1398+ Some ( s) => & s[ ..] ,
1399+ None => "Box<dyn Any>" ,
1400+ } ,
1401+ } ;
1402+ let thread = std:: thread:: current( ) ;
1403+ let name = thread. name( ) . unwrap_or( "<unnamed>" ) ;
1404+ let _ = write!(
1405+ & mut out,
1406+ "thread '{name}' panicked at {location}:\n \
1407+ {msg}\n \
1408+ stack backtrace:\n \
1409+ {:#}",
1410+ std:: backtrace:: Backtrace :: force_capture( )
1411+ ) ;
13951412 }
13961413 }
13971414
You can’t perform that action at this time.
0 commit comments