From cacc31f8a348a97da8681c0e55dd106818b7c8cd Mon Sep 17 00:00:00 2001 From: Michael Woerister Date: Mon, 31 Jul 2017 15:41:41 +0200 Subject: [PATCH] async-llvm(26): Print error when failing to acquire Jobserver token. --- src/librustc_trans/back/write.rs | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/librustc_trans/back/write.rs b/src/librustc_trans/back/write.rs index b3b155c88100..85860f0e33a3 100644 --- a/src/librustc_trans/back/write.rs +++ b/src/librustc_trans/back/write.rs @@ -1389,21 +1389,25 @@ fn start_executing_work(sess: &Session, // this to spawn a new unit of work, or it may get dropped // immediately if we have no more work to spawn. Message::Token(token) => { - if let Ok(token) = token { - tokens.push(token); + match token { + Ok(token) => { + tokens.push(token); - if main_thread_worker_state == MainThreadWorkerState::LLVMing { - // If the main thread token is used for LLVM work - // at the moment, we turn that thread into a regular - // LLVM worker thread, so the main thread is free - // to react to translation demand. - main_thread_worker_state = MainThreadWorkerState::Idle; - running += 1; + if main_thread_worker_state == MainThreadWorkerState::LLVMing { + // If the main thread token is used for LLVM work + // at the moment, we turn that thread into a regular + // LLVM worker thread, so the main thread is free + // to react to translation demand. + main_thread_worker_state = MainThreadWorkerState::Idle; + running += 1; + } + } + Err(e) => { + let msg = &format!("failed to acquire jobserver token: {}", e); + shared_emitter.fatal(msg); + // Exit the coordinator thread + panic!() } - } else { - shared_emitter.fatal("failed to acquire jobserver token"); - // Exit the coordinator thread - panic!() } }