Skip to content

Commit 610dbdd

Browse files
committed
fixed cargo-miri bug for windows users
1 parent 2b3b865 commit 610dbdd

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/bin/cargo-miri.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -333,17 +333,11 @@ path = "lib.rs"
333333
None => true,
334334
Some(target) => target == rustc_version::version_meta().unwrap().host,
335335
};
336-
let mut sysroot = if is_host { dir.join("HOST") } else { PathBuf::from(dir) };
337-
if cfg!(target_os = "windows") {
338-
// Replace backslashes in path to slashes as they cause problems.
339-
// Win10 Powershell can work with slashes in paths.
340-
sysroot = PathBuf::from(
341-
String::from(sysroot.to_str().unwrap()).replace("\\", "/")
342-
);
343-
}
336+
let sysroot = if is_host { dir.join("HOST") } else { PathBuf::from(dir) };
337+
344338
std::env::set_var("MIRI_SYSROOT", &sysroot); // pass the env var to the processes we spawn, which will turn it into "--sysroot" flags
345339
if print_env {
346-
println!("MIRI_SYSROOT={}", sysroot.display());
340+
println!("MIRI_SYSROOT={:?}", &sysroot); // for Windows users, prints path with backslashes escaped.
347341
} else if !ask_user {
348342
println!("A libstd for Miri is now available in `{}`.", sysroot.display());
349343
}

0 commit comments

Comments
 (0)