diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-03-29 06:02:42 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-29 06:02:42 +0200 |
| commit | 09c139846b5456cf5c09af9ddd3013ab7171334c (patch) | |
| tree | c158a7a2048ed69237a78746cedc5db75ce46cc9 | |
| parent | 6be27b19a6ccd7ade90e41895a6fe20a2490e9b0 (diff) | |
| parent | be6a09f96bbe0c0c6ce909a84ea0164112edfced (diff) | |
| download | rust-09c139846b5456cf5c09af9ddd3013ab7171334c.tar.gz rust-09c139846b5456cf5c09af9ddd3013ab7171334c.zip | |
Rollup merge of #109694 - BelovDV:fix-panic-jobserver-token, r=bjorn3
do not panic on failure to acquire jobserver token Purpose: remove `panic`. Rust fails to acquire token if an error in build system occurs - environment variable contains incorrect `jobserver-auth`. It isn't ice so compiler shouldn't panic on such error. Related issue: #46981
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/write.rs | 4 | ||||
| -rw-r--r-- | tests/run-make/jobserver-error/Makefile | 8 | ||||
| -rw-r--r-- | tests/run-make/jobserver-error/jobserver.stderr | 4 |
3 files changed, 14 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs index 7ce72d21727..2dda4cd1694 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<B: ExtraBackendMethods>( 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 00000000000..3b9104fc354 --- /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</dev/null' 2>&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 00000000000..d18e15a2628 --- /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 + |
