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 @@ -1350,8 +1350,25 @@ pub fn install_ice_hook(bug_report_url: &'static str, extra_info: fn(&Handler))
13501350 && let Ok ( mut out) =
13511351 File :: options( ) . create( true ) . append( true ) . open( & ice_path)
13521352 {
1353- let _ =
1354- write!( & mut out, "{info}{:#}" , std:: backtrace:: Backtrace :: force_capture( ) ) ;
1353+ // The current implementation always returns `Some`.
1354+ let location = info. location( ) . unwrap( ) ;
1355+ let msg = match info. payload( ) . downcast_ref:: <& ' static str >( ) {
1356+ Some ( s) => * s,
1357+ None => match info. payload( ) . downcast_ref:: <String >( ) {
1358+ Some ( s) => & s[ ..] ,
1359+ None => "Box<dyn Any>" ,
1360+ } ,
1361+ } ;
1362+ let thread = std:: thread:: current( ) ;
1363+ let name = thread. name( ) . unwrap_or( "<unnamed>" ) ;
1364+ let _ = write!(
1365+ & mut out,
1366+ "thread '{name}' panicked at {location}:\n \
1367+ {msg}\n \
1368+ stack backtrace:\n \
1369+ {:#}",
1370+ std:: backtrace:: Backtrace :: force_capture( )
1371+ ) ;
13551372 }
13561373 }
13571374
You can’t perform that action at this time.
0 commit comments