File tree 1 file changed +19
-2
lines changed
compiler/rustc_driver_impl/src
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))
1350
1350
&& let Ok ( mut out) =
1351
1351
File :: options( ) . create( true ) . append( true ) . open( & ice_path)
1352
1352
{
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
+ ) ;
1355
1372
}
1356
1373
}
1357
1374
You can’t perform that action at this time.
0 commit comments