diff options
| author | bors <bors@rust-lang.org> | 2023-12-03 16:28:22 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-12-03 16:28:22 +0000 |
| commit | db07cccb1e6b448eb1fec576096b587680e4ff69 (patch) | |
| tree | 9e8ce5f2d1a586120a74c56d5e211c987bac4502 /compiler/rustc_session | |
| parent | 21d88b32cb5ff05b7a43c99e7c508bbbc65e036d (diff) | |
| parent | 45e634234690a7d061e133b8cf9d31af34b29a0b (diff) | |
| download | rust-db07cccb1e6b448eb1fec576096b587680e4ff69.tar.gz rust-db07cccb1e6b448eb1fec576096b587680e4ff69.zip | |
Auto merge of #113730 - belovdv:jobserver-init-check, r=petrochenkov
Report errors in jobserver inherited through environment variables This pr attempts to catch situations, when jobserver exists, but is not being inherited. r? `@petrochenkov`
Diffstat (limited to 'compiler/rustc_session')
| -rw-r--r-- | compiler/rustc_session/src/session.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index c6f435a8f92..57a535d8c10 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -24,7 +24,7 @@ use rustc_errors::registry::Registry; use rustc_errors::{ error_code, fallback_fluent_bundle, DiagnosticBuilder, DiagnosticId, DiagnosticMessage, ErrorGuaranteed, FluentBundle, Handler, IntoDiagnostic, LazyFallbackBundle, MultiSpan, Noted, - TerminalUrl, + SubdiagnosticMessage, TerminalUrl, }; use rustc_macros::HashStable_Generic; pub use rustc_span::def_id::StableCrateId; @@ -1469,6 +1469,11 @@ 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| { + handler.early_warn_with_note(err, "the build environment is likely misconfigured") + }); + let sess = Session { target: target_cfg, host, @@ -1776,6 +1781,16 @@ impl EarlyErrorHandler { pub fn early_warn(&self, msg: impl Into<DiagnosticMessage>) { self.handler.struct_warn(msg).emit() } + + #[allow(rustc::untranslatable_diagnostic)] + #[allow(rustc::diagnostic_outside_of_impl)] + pub fn early_warn_with_note( + &self, + msg: impl Into<DiagnosticMessage>, + note: impl Into<SubdiagnosticMessage>, + ) { + self.handler.struct_warn(msg).note(note).emit() + } } fn mk_emitter(output: ErrorOutputType) -> Box<DynEmitter> { |
