Skip to content

Commit

Permalink
Auto merge of #13225 - ehuss:fix-jobserver-always, r=epage
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
bors committed Dec 31, 2023
2 parents 2ed2dbd + 448c437 commit bc7e5ce
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/cargo/ops/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,11 @@ pub fn fix_exec_rustc(config: &Config, lock_addr: &str) -> CargoResult<()> {
rustc.retry_with_argfile(true);
rustc.env_remove(FIX_ENV_INTERNAL);
args.apply(&mut rustc);
// Removes `FD_CLOEXEC` set by `jobserver::Client` to ensure that the
// compiler can access the jobserver.
if let Some(client) = config.jobserver_from_env() {
rustc.inherit_jobserver(client);
}

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

0 comments on commit bc7e5ce

Please sign in to comment.