]> git.lizzy.rs Git - rust.git/commitdiff
change cargo-miri.rs to fix issue #978
authorYOUNGSUK_KIM <ykim837@gatech.edu>
Sat, 5 Oct 2019 21:11:09 +0000 (17:11 -0400)
committerYOUNGSUK_KIM <ykim837@gatech.edu>
Sat, 5 Oct 2019 21:11:09 +0000 (17:11 -0400)
src/bin/cargo-miri.rs

index 43e8761d48c17c1be1f63d545c7165319263c876..1f1705a49ac951afe692585f5567ff40445c994a 100644 (file)
@@ -333,7 +333,14 @@ fn setup(ask_user: bool) {
         None => true,
         Some(target) => target == rustc_version::version_meta().unwrap().host,
     };
-    let sysroot = if is_host { dir.join("HOST") } else { PathBuf::from(dir) };
+    let mut sysroot = if is_host { dir.join("HOST") } else { PathBuf::from(dir) }; 
+    if cfg!(target_os = "windows") {
+        // Replace backslashes in path to slashes as they cause problems.
+        // Win10 Powershell can work with slashes in paths.
+        sysroot = PathBuf::from(
+            String::from(sysroot.to_str().unwrap()).replace("\\", "/")
+        );
+    }
     std::env::set_var("MIRI_SYSROOT", &sysroot); // pass the env var to the processes we spawn, which will turn it into "--sysroot" flags
     if print_env {
         println!("MIRI_SYSROOT={}", sysroot.display());