Ignore RUST_SRC_PATH if it is set to invalid value
Folks report a ton of hard-to-diagnose issues, the solution for which is "unset RUST_SRC_PATH". Let's just ignore RUST_SRC_PATH when it won't work anyway!
This commit is contained in:
parent
7709b6a2d4
commit
85db47ac76
@ -114,8 +114,12 @@ fn discover_sysroot_src_dir(current_dir: &AbsPath) -> Result<AbsPathBuf> {
|
||||
if let Ok(path) = env::var("RUST_SRC_PATH") {
|
||||
let path = AbsPathBuf::try_from(path.as_str())
|
||||
.map_err(|path| format_err!("RUST_SRC_PATH must be absolute: {}", path.display()))?;
|
||||
log::debug!("Discovered sysroot by RUST_SRC_PATH: {}", path.display());
|
||||
return Ok(path);
|
||||
let core = path.join("core");
|
||||
if core.exists() {
|
||||
log::debug!("Discovered sysroot by RUST_SRC_PATH: {}", path.display());
|
||||
return Ok(path);
|
||||
}
|
||||
log::debug!("RUST_SRC_PATH is set, but is invalid (no core: {:?}), ignoring", core);
|
||||
}
|
||||
|
||||
let sysroot_path = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user