1
Fork 0

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
This commit is contained in:
oksbsb 2023-12-07 22:39:07 +08:00
parent 370c91100c
commit dabedb711f
6 changed files with 19 additions and 16 deletions

View file

@ -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> {