Skip to content

Commit

Permalink
Auto merge of #122218 - Zoxc:no-interleave-panics, r=michaelwoerister
Browse files Browse the repository at this point in the history
Lock stderr in panic handler

Fixes #119789.
  • Loading branch information
bors committed Mar 12, 2024
2 parents 3b85d2c + 288380d commit 7de1a1f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,9 @@ pub fn install_ice_hook(
panic::update_hook(Box::new(
move |default_hook: &(dyn Fn(&PanicInfo<'_>) + Send + Sync + 'static),
info: &PanicInfo<'_>| {
// Lock stderr to prevent interleaving of concurrent panics.
let _guard = io::stderr().lock();

// If the error was caused by a broken pipe then this is not a bug.
// Write the error and return immediately. See #98700.
#[cfg(windows)]
Expand Down

1 comment on commit 7de1a1f

@LowLevelCodingCH
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hello

Please sign in to comment.