diff options
| author | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2024-03-09 01:26:59 +0100 |
|---|---|---|
| committer | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2024-03-09 03:45:18 +0100 |
| commit | 288380d4578e6e0be913fea6852226227a6c4170 (patch) | |
| tree | c063d03feb4fdab827804994ff3db79db6ec6d1e /compiler/rustc_driver_impl/src | |
| parent | a655e648a9f94d74263108366b83e677af56e35d (diff) | |
Lock stderr in panic handler
Diffstat (limited to 'compiler/rustc_driver_impl/src')
| -rw-r--r-- | compiler/rustc_driver_impl/src/lib.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index e06d1d245b2..b7481907187 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -1317,6 +1317,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)] |
