From be6a09f96bbe0c0c6ce909a84ea0164112edfced Mon Sep 17 00:00:00 2001 From: Daniil Belov <70999565+BelovDV@users.noreply.github.com> Date: Tue, 28 Mar 2023 12:13:42 +0300 Subject: [PATCH] [fix] don't panic on failure to acquire jobserver token --- compiler/rustc_codegen_ssa/src/back/write.rs | 4 ++-- tests/run-make/jobserver-error/Makefile | 8 ++++++++ tests/run-make/jobserver-error/jobserver.stderr | 4 ++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 tests/run-make/jobserver-error/Makefile create mode 100644 tests/run-make/jobserver-error/jobserver.stderr diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs index 7ce72d2172799..2dda4cd169410 100644 --- a/compiler/rustc_codegen_ssa/src/back/write.rs +++ b/compiler/rustc_codegen_ssa/src/back/write.rs @@ -1452,8 +1452,8 @@ fn start_executing_work( Err(e) => { let msg = &format!("failed to acquire jobserver token: {}", e); shared_emitter.fatal(msg); - // Exit the coordinator thread - panic!("{}", msg) + codegen_done = true; + codegen_aborted = true; } } } diff --git a/tests/run-make/jobserver-error/Makefile b/tests/run-make/jobserver-error/Makefile new file mode 100644 index 0000000000000..3b9104fc35484 --- /dev/null +++ b/tests/run-make/jobserver-error/Makefile @@ -0,0 +1,8 @@ +include ../../run-make-fulldeps/tools.mk + +# only-linux + +# Test compiler behavior in case: `jobserver-auth` points to correct pipe which is not jobserver. + +all: + bash -c 'echo "fn main() {}" | MAKEFLAGS="--jobserver-auth=3,3" $(RUSTC) - 3&1 | diff jobserver.stderr - diff --git a/tests/run-make/jobserver-error/jobserver.stderr b/tests/run-make/jobserver-error/jobserver.stderr new file mode 100644 index 0000000000000..d18e15a262889 --- /dev/null +++ b/tests/run-make/jobserver-error/jobserver.stderr @@ -0,0 +1,4 @@ +error: failed to acquire jobserver token: early EOF on jobserver pipe + +error: aborting due to previous error +