1
Fork 0

Rollup merge of #114128 - estebank:delayed-span-bug-dump, r=davidtwco

When flushing delayed span bugs, write to the ICE dump file even if it doesn't exist

Fix #113881.
This commit is contained in:
Matthias Krüger 2023-07-28 19:51:15 +02:00 committed by GitHub
commit 02f1e2ada7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -1655,11 +1655,11 @@ impl HandlerInner {
let backtrace = std::env::var_os("RUST_BACKTRACE").map_or(true, |x| &x != "0"); let backtrace = std::env::var_os("RUST_BACKTRACE").map_or(true, |x| &x != "0");
for bug in bugs { for bug in bugs {
if let Some(file) = self.ice_file.as_ref() if let Some(file) = self.ice_file.as_ref()
&& let Ok(mut out) = std::fs::File::options().append(true).open(file) && let Ok(mut out) = std::fs::File::options().create(true).append(true).open(file)
{ {
let _ = write!( let _ = write!(
&mut out, &mut out,
"\n\ndelayed span bug: {}\n{}", "delayed span bug: {}\n{}\n",
bug.inner.styled_message().iter().filter_map(|(msg, _)| msg.as_str()).collect::<String>(), bug.inner.styled_message().iter().filter_map(|(msg, _)| msg.as_str()).collect::<String>(),
&bug.note &bug.note
); );

View file

@ -300,7 +300,7 @@ pub fn panic_hook_with_disk_dump(info: &PanicInfo<'_>, path: Option<&crate::path
}; };
if let Some(path) = path if let Some(path) = path
&& let Ok(mut out) = crate::fs::File::options().create(true).write(true).open(&path) && let Ok(mut out) = crate::fs::File::options().create(true).append(true).open(&path)
{ {
write(&mut out, BacktraceStyle::full()); write(&mut out, BacktraceStyle::full());
} }