Make ICE backtrace actually match the panic handler
This commit is contained in:
parent
8ad2379407
commit
b59480784d
@ -1350,8 +1350,25 @@ pub fn install_ice_hook(bug_report_url: &'static str, extra_info: fn(&Handler))
|
||||
&& let Ok(mut out) =
|
||||
File::options().create(true).append(true).open(&ice_path)
|
||||
{
|
||||
let _ =
|
||||
write!(&mut out, "{info}{:#}", std::backtrace::Backtrace::force_capture());
|
||||
// The current implementation always returns `Some`.
|
||||
let location = info.location().unwrap();
|
||||
let msg = match info.payload().downcast_ref::<&'static str>() {
|
||||
Some(s) => *s,
|
||||
None => match info.payload().downcast_ref::<String>() {
|
||||
Some(s) => &s[..],
|
||||
None => "Box<dyn Any>",
|
||||
},
|
||||
};
|
||||
let thread = std::thread::current();
|
||||
let name = thread.name().unwrap_or("<unnamed>");
|
||||
let _ = write!(
|
||||
&mut out,
|
||||
"thread '{name}' panicked at {location}:\n\
|
||||
{msg}\n\
|
||||
stack backtrace:\n\
|
||||
{:#}",
|
||||
std::backtrace::Backtrace::force_capture()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user