Skip to content

Commit 656213c

Browse files
committed
When flushing delayed span bugs, write to the ICE dump file even if it doesn't exist
Fix #113881.
1 parent c06b2b9 commit 656213c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

compiler/rustc_errors/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1673,11 +1673,11 @@ impl HandlerInner {
16731673
let backtrace = std::env::var_os("RUST_BACKTRACE").map_or(true, |x| &x != "0");
16741674
for bug in bugs {
16751675
if let Some(file) = self.ice_file.as_ref()
1676-
&& let Ok(mut out) = std::fs::File::options().append(true).open(file)
1676+
&& let Ok(mut out) = std::fs::File::options().create(true).append(true).open(file)
16771677
{
16781678
let _ = write!(
16791679
&mut out,
1680-
"\n\ndelayed span bug: {}\n{}",
1680+
"delayed span bug: {}\n{}\n",
16811681
bug.inner.styled_message().iter().filter_map(|(msg, _)| msg.as_str()).collect::<String>(),
16821682
&bug.note
16831683
);

library/std/src/panicking.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ pub fn panic_hook_with_disk_dump(info: &PanicInfo<'_>, path: Option<&crate::path
300300
};
301301

302302
if let Some(path) = path
303-
&& let Ok(mut out) = crate::fs::File::options().create(true).write(true).open(&path)
303+
&& let Ok(mut out) = crate::fs::File::options().create(true).append(true).open(&path)
304304
{
305305
write(&mut out, BacktraceStyle::full());
306306
}

0 commit comments

Comments
 (0)