Skip to content

Commit bc7e5ce

Browse files
committed
Auto merge of #13225 - ehuss:fix-jobserver-always, r=epage
`cargo fix`: always inherit the jobserver #12951 changed `cargo fix` to ensure that `rustc` has access to the jobserver. However, it only did that for the final "verification" step. It was not set for any of the previous calls to rustc (which is up to ~5 calls). I'm not sure if this was done intentionally, I did not see any discussion of this in #12951. This isn't too important in the grand scheme of things, because `rustc` is not doing codegen, so the parallel behavior is currently not used. However, this removes an extraneous `warning: failed to connect to jobserver from environment variable` warning that is printed in cargo's log every time it runs rustc. It also might be relevant in the future if rustc enables the parallel frontend.
2 parents 2ed2dbd + 448c437 commit bc7e5ce

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/cargo/ops/fix.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,11 @@ pub fn fix_exec_rustc(config: &Config, lock_addr: &str) -> CargoResult<()> {
379379
rustc.retry_with_argfile(true);
380380
rustc.env_remove(FIX_ENV_INTERNAL);
381381
args.apply(&mut rustc);
382+
// Removes `FD_CLOEXEC` set by `jobserver::Client` to ensure that the
383+
// compiler can access the jobserver.
384+
if let Some(client) = config.jobserver_from_env() {
385+
rustc.inherit_jobserver(client);
386+
}
382387

383388
trace!("start rustfixing {:?}", args.file);
384389
let json_error_rustc = {
@@ -451,11 +456,6 @@ pub fn fix_exec_rustc(config: &Config, lock_addr: &str) -> CargoResult<()> {
451456
// things like colored output to work correctly.
452457
rustc.arg(arg);
453458
}
454-
// Removes `FD_CLOEXEC` set by `jobserver::Client` to pass jobserver
455-
// as environment variables specify.
456-
if let Some(client) = config.jobserver_from_env() {
457-
rustc.inherit_jobserver(client);
458-
}
459459
debug!("calling rustc to display remaining diagnostics: {rustc}");
460460
exit_with(rustc.status()?);
461461
}

0 commit comments

Comments
 (0)