Skip to content

Commit

Permalink
remove env::var from util::rustc::rustc_fingerprint
Browse files Browse the repository at this point in the history
  • Loading branch information
kylematsuda committed Feb 22, 2023
1 parent f73a638 commit 5035cb2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/cargo/util/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ impl Config {
} else {
None
},
self,
)
}

Expand Down
12 changes: 8 additions & 4 deletions src/cargo/util/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use log::{debug, info, warn};
use serde::{Deserialize, Serialize};

use crate::util::interning::InternedString;
use crate::util::{profile, CargoResult, StableHasher};
use crate::util::{profile, CargoResult, Config, StableHasher};

/// Information on the `rustc` executable
#[derive(Debug)]
Expand Down Expand Up @@ -43,6 +43,7 @@ impl Rustc {
workspace_wrapper: Option<PathBuf>,
rustup_rustc: &Path,
cache_location: Option<PathBuf>,
config: &Config,
) -> CargoResult<Rustc> {
let _p = profile::start("Rustc::new");

Expand All @@ -52,6 +53,7 @@ impl Rustc {
&path,
rustup_rustc,
cache_location,
config,
);

let mut cmd = ProcessBuilder::new(&path);
Expand Down Expand Up @@ -173,10 +175,11 @@ impl Cache {
rustc: &Path,
rustup_rustc: &Path,
cache_location: Option<PathBuf>,
config: &Config,
) -> Cache {
match (
cache_location,
rustc_fingerprint(wrapper, workspace_wrapper, rustc, rustup_rustc),
rustc_fingerprint(wrapper, workspace_wrapper, rustc, rustup_rustc, config),
) {
(Some(cache_location), Ok(rustc_fingerprint)) => {
let empty = CacheData {
Expand Down Expand Up @@ -296,6 +299,7 @@ fn rustc_fingerprint(
workspace_wrapper: Option<&Path>,
rustc: &Path,
rustup_rustc: &Path,
config: &Config,
) -> CargoResult<u64> {
let mut hasher = StableHasher::new();

Expand Down Expand Up @@ -329,8 +333,8 @@ fn rustc_fingerprint(
let maybe_rustup = rustup_rustc == rustc;
match (
maybe_rustup,
env::var("RUSTUP_HOME"),
env::var("RUSTUP_TOOLCHAIN"),
config.get_env("RUSTUP_HOME"),
config.get_env("RUSTUP_TOOLCHAIN"),
) {
(_, Ok(rustup_home), Ok(rustup_toolchain)) => {
debug!("adding rustup info to rustc fingerprint");
Expand Down

0 comments on commit 5035cb2

Please sign in to comment.