Skip to content

Commit

Permalink
Rollup merge of rust-lang#109694 - BelovDV:fix-panic-jobserver-token,…
Browse files Browse the repository at this point in the history
… 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: rust-lang#46981
  • Loading branch information
matthiaskrgr authored Mar 29, 2023
2 parents 6be27b1 + be6a09f commit 09c1398
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_ssa/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions tests/run-make/jobserver-error/Makefile
Original file line number Diff line number Diff line change
@@ -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 -
4 changes: 4 additions & 0 deletions tests/run-make/jobserver-error/jobserver.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
error: failed to acquire jobserver token: early EOF on jobserver pipe

error: aborting due to previous error

0 comments on commit 09c1398

Please sign in to comment.