rustc is rustc.exe on windows
authorAleksey Kladov <aleksey.kladov@gmail.com>
Mon, 16 Apr 2018 16:22:53 +0000 (19:22 +0300)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Mon, 16 Apr 2018 16:24:34 +0000 (19:24 +0300)
src/cargo/ops/cargo_compile.rs
src/cargo/util/config.rs
src/cargo/util/paths.rs
src/cargo/util/rustc.rs

index fbf6acb3024cf8b5bf5d0e9d0025e8a245ccf153..32d2cd2003c176e566a2a11f016855fbad74b3ed 100644 (file)
@@ -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;
index c7a37e744e255f442716e575d367a03172723a07..ac8bf21f6a405a19d5d4d5957322b74b0cdbcee0 100644 (file)
@@ -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 {
index 350663620aea563e621e42f564fe0156f6a7499f..de87a6a3cb096f1d4efafbfbbfc446d03c72c3f6 100644 (file)
@@ -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))
 }
 
index 25bb9b5ba95dbedfec44cff0429f57ca1a548b9d..883563d2fd94bc4b5764d70958efa5a7d09a8fdc 100644 (file)
@@ -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"),
         _ => (),
     }