Skip to content

Commit

Permalink
rustc is rustc.exe on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
matklad committed Apr 16, 2018
1 parent c0e326d commit 76b0a8a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
4 changes: 3 additions & 1 deletion src/cargo/ops/cargo_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,9 @@ pub fn compile_ws<'a>(
bail!("jobs must be at least 1")
}

let rustc_info_cache = ws.target_dir().join(".rustc_info.json").into_path_unlocked();
let rustc_info_cache = ws.target_dir()
.join(".rustc_info.json")
.into_path_unlocked();
let mut build_config = BuildConfig::new(config, jobs, &target, Some(rustc_info_cache))?;
build_config.release = release;
build_config.test = mode == CompileMode::Test || mode == CompileMode::Bench;
Expand Down
6 changes: 5 additions & 1 deletion src/cargo/util/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,11 @@ impl Config {
Rustc::new(
self.get_tool("rustc")?,
self.maybe_get_tool("rustc_wrapper")?,
&self.home().join("bin").join("rustc").into_path_unlocked(),
&self.home()
.join("bin")
.join("rustc")
.into_path_unlocked()
.with_extension(env::consts::EXE_EXTENSION),
if self.cache_rustc_info {
cache_location
} else {
Expand Down
3 changes: 1 addition & 2 deletions src/cargo/util/paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ pub fn append(path: &Path, contents: &[u8]) -> CargoResult<()> {
}

pub fn mtime(path: &Path) -> CargoResult<FileTime> {
let meta =
fs::metadata(path).chain_err(|| format!("failed to stat `{}`", path.display()))?;
let meta = fs::metadata(path).chain_err(|| format!("failed to stat `{}`", path.display()))?;
Ok(FileTime::from_last_modification_time(&meta))
}

Expand Down
17 changes: 10 additions & 7 deletions src/cargo/util/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,21 +219,24 @@ fn rustc_fingerprint(path: &Path, rustup_rustc: &Path) -> CargoResult<u64> {
// If we don't see rustup env vars, but it looks like the compiler
// is managed by rustup, we conservatively bail out.
let maybe_rustup = rustup_rustc == path;
match (maybe_rustup, env::var("RUSTUP_HOME"), env::var("RUSTUP_TOOLCHAIN")) {
match (
maybe_rustup,
env::var("RUSTUP_HOME"),
env::var("RUSTUP_TOOLCHAIN"),
) {
(_, Ok(rustup_home), Ok(rustup_toolchain)) => {
debug!("adding rustup info to rustc fingerprint");
rustup_toolchain.hash(&mut hasher);
rustup_home.hash(&mut hasher);
let rustup_rustc = Path::new(&rustup_home)
let real_rustc = Path::new(&rustup_home)
.join("toolchains")
.join(rustup_toolchain)
.join("bin")
.join("rustc");
paths::mtime(&rustup_rustc)?.hash(&mut hasher);
}
(true, _, _) => {
bail!("probably rustup rustc, but without rustup's env vars")
.join("rustc")
.with_extension(env::consts::EXE_EXTENSION);
paths::mtime(&real_rustc)?.hash(&mut hasher);
}
(true, _, _) => bail!("probably rustup rustc, but without rustup's env vars"),
_ => (),
}

Expand Down

0 comments on commit 76b0a8a

Please sign in to comment.