Skip to content

Commit 09c1398

Browse files
authored
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
2 parents 6be27b1 + be6a09f commit 09c1398

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

Diff for: compiler/rustc_codegen_ssa/src/back/write.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1452,8 +1452,8 @@ fn start_executing_work<B: ExtraBackendMethods>(
14521452
Err(e) => {
14531453
let msg = &format!("failed to acquire jobserver token: {}", e);
14541454
shared_emitter.fatal(msg);
1455-
// Exit the coordinator thread
1456-
panic!("{}", msg)
1455+
codegen_done = true;
1456+
codegen_aborted = true;
14571457
}
14581458
}
14591459
}

Diff for: tests/run-make/jobserver-error/Makefile

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
include ../../run-make-fulldeps/tools.mk
2+
3+
# only-linux
4+
5+
# Test compiler behavior in case: `jobserver-auth` points to correct pipe which is not jobserver.
6+
7+
all:
8+
bash -c 'echo "fn main() {}" | MAKEFLAGS="--jobserver-auth=3,3" $(RUSTC) - 3</dev/null' 2>&1 | diff jobserver.stderr -

Diff for: tests/run-make/jobserver-error/jobserver.stderr

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
error: failed to acquire jobserver token: early EOF on jobserver pipe
2+
3+
error: aborting due to previous error
4+

0 commit comments

Comments
 (0)