Auto merge of #1471 - RalfJung:win, r=RalfJung
on Windows, strip the '\\?\' prefix from the canonical path This should help with https://github.com/rust-lang/rust/pull/74146#issuecomment-655723028
This commit is contained in:
commit
b245786f9d
@ -258,8 +258,20 @@ fn setup(subcommand: MiriCommand) {
|
||||
// Determine where the rust sources are located. `XARGO_RUST_SRC` env var trumps everything.
|
||||
let rust_src = match std::env::var_os("XARGO_RUST_SRC") {
|
||||
Some(val) => {
|
||||
let val = PathBuf::from(val);
|
||||
val.canonicalize().unwrap_or(val)
|
||||
let path = PathBuf::from(val);
|
||||
let path = path.canonicalize().unwrap_or(path);
|
||||
|
||||
// On Windows, this produces a path starting with `\\?\`, which xargo cannot deal with.
|
||||
// Strip that prefix; the resulting path should still be valid.
|
||||
#[cfg(windows)]
|
||||
let path = {
|
||||
let str = path.into_os_string().into_string()
|
||||
.expect("non-unicode paths are currently not supported");
|
||||
let str = str.strip_prefix(r"\\?\").map(String::from).unwrap_or(str);
|
||||
PathBuf::from(str)
|
||||
};
|
||||
|
||||
path
|
||||
}
|
||||
None => {
|
||||
// Check for `rust-src` rustup component.
|
||||
|
Loading…
Reference in New Issue
Block a user