Skip to content

Commit

Permalink
Rollup merge of rust-lang#114128 - estebank:delayed-span-bug-dump, r=…
Browse files Browse the repository at this point in the history
…davidtwco

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

Fix rust-lang#113881.
  • Loading branch information
matthiaskrgr authored Jul 28, 2023
2 parents 785e6fd + 656213c commit 02359be
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1655,11 +1655,11 @@ impl HandlerInner {
let backtrace = std::env::var_os("RUST_BACKTRACE").map_or(true, |x| &x != "0");
for bug in bugs {
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!(
&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.note
);
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/panicking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ pub fn panic_hook_with_disk_dump(info: &PanicInfo<'_>, path: Option<&crate::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());
}
Expand Down

0 comments on commit 02359be

Please sign in to comment.