diff options
| author | oksbsb <oksbsb@126.com> | 2023-12-07 22:39:07 +0800 |
|---|---|---|
| committer | oksbsb <oksbsb@126.com> | 2023-12-08 09:50:28 +0800 |
| commit | dabedb711f13e14401e6be2f9a58a9bc1974a488 (patch) | |
| tree | a4243dae73bfc27d7b6193b4c101cc3d46ca0bc2 /compiler/rustc_session | |
| parent | 370c91100ce008f3f31e207adbfee8aeafe09b14 (diff) | |
| download | rust-dabedb711f13e14401e6be2f9a58a9bc1974a488.tar.gz rust-dabedb711f13e14401e6be2f9a58a9bc1974a488.zip | |
1. fix jobserver GLOBAL_CLIENT_CHECKED uninitialized before use
2. jobserver::initialize_checked should call before build_session, still should use EarlyErrorHandler, so revert stderr change in #118635
Diffstat (limited to 'compiler/rustc_session')
| -rw-r--r-- | compiler/rustc_session/src/session.rs | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 123e9c788f5..24c7459392a 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -1474,17 +1474,6 @@ pub fn build_session( let asm_arch = if target_cfg.allow_asm { InlineAsmArch::from_str(&target_cfg.arch).ok() } else { None }; - // Check jobserver before getting `jobserver::client`. - jobserver::check(|err| { - #[allow(rustc::untranslatable_diagnostic)] - #[allow(rustc::diagnostic_outside_of_impl)] - parse_sess - .span_diagnostic - .struct_warn(err) - .note("the build environment is likely misconfigured") - .emit() - }); - let sess = Session { target: target_cfg, host, @@ -1792,6 +1781,18 @@ impl EarlyErrorHandler { pub fn early_warn(&self, msg: impl Into<DiagnosticMessage>) { self.handler.struct_warn(msg).emit() } + + pub fn initialize_checked_jobserver(&self) { + // initialize jobserver before getting `jobserver::client` and `build_session`. + jobserver::initialize_checked(|err| { + #[allow(rustc::untranslatable_diagnostic)] + #[allow(rustc::diagnostic_outside_of_impl)] + self.handler + .struct_warn(err) + .note("the build environment is likely misconfigured") + .emit() + }); + } } fn mk_emitter(output: ErrorOutputType) -> Box<DynEmitter> { |
