From 610dbdd562bc327f016a326c703073cee97dc645 Mon Sep 17 00:00:00 2001 From: YOUNGSUK_KIM Date: Thu, 10 Oct 2019 11:03:20 -0400 Subject: [PATCH] fixed cargo-miri bug for windows users --- src/bin/cargo-miri.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/bin/cargo-miri.rs b/src/bin/cargo-miri.rs index 1f1705a49ac9..521ac8fa065c 100644 --- a/src/bin/cargo-miri.rs +++ b/src/bin/cargo-miri.rs @@ -333,17 +333,11 @@ path = "lib.rs" None => true, Some(target) => target == rustc_version::version_meta().unwrap().host, }; - 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("\\", "/") - ); - } + let sysroot = if is_host { dir.join("HOST") } else { PathBuf::from(dir) }; + 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()); + println!("MIRI_SYSROOT={:?}", &sysroot); // for Windows users, prints path with backslashes escaped. } else if !ask_user { println!("A libstd for Miri is now available in `{}`.", sysroot.display()); }