Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set RUSTC and RUSTDOC env for child processes run through the proxy #2958

Merged
merged 1 commit into from
Mar 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/toolchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,19 @@ impl<'a> InstalledCommonToolchain<'a> {

cmd.env("RUSTUP_TOOLCHAIN", &self.0.name);
cmd.env("RUSTUP_HOME", &self.0.cfg.rustup_dir);
// It's valid (although slightly cursed) to tell a rustup cargo proxy to use a custom rustc
// from a different toolchain.
if env::var("RUSTC").is_err() {
// Set RUSTC for the spawned binary. This serves two purposes:
// 1. It avoids the overhead of having to re-parse `settings.toml` on each proxy.
// In projects with many crates, this can have non-trivial overhead.
// 2. For build scripts, it provides an absolute path for RUSTC rather than forcing them to look it up in PATH.
// This allows them to find the sysroot path for the toolchain, rather than ending up somewhere in CARGO_HOME.
cmd.env("RUSTC", self.0.path.join("bin").join("rustc"));
}
if env::var("RUSTDOC").is_err() {
cmd.env("RUSTDOC", self.0.path.join("bin").join("rustdoc"));
}
}

fn set_ldpath(&self, cmd: &mut Command) {
Expand Down