Skip to content

Commit

Permalink
Auto merge of rust-lang#122218 - Zoxc:no-interleave-panics, r=michael…
Browse files Browse the repository at this point in the history
…woerister

Lock stderr in panic handler

Fixes rust-lang#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
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

0 comments on commit 7de1a1f

Please sign in to comment.