diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-11-06 10:33:04 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-11-06 10:33:04 +0000 |
commit | 2c408c68a4a27e9a85ce85ec1342e3af58c1571f (patch) | |
tree | f7484f09c6b8c56ffcc996bf01bad6ce167bc904 | |
parent | 7709b6a2d4b74b5838fbe5b30b6188d6a549b580 (diff) | |
parent | 85db47ac76c383295caee0c1d4284544b761add9 (diff) |
Merge #6479
6479: Ignore RUST_SRC_PATH if it is set to invalid value r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
-rw-r--r-- | crates/project_model/src/sysroot.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/crates/project_model/src/sysroot.rs b/crates/project_model/src/sysroot.rs index 3fe494729..b0e8863f6 100644 --- a/crates/project_model/src/sysroot.rs +++ b/crates/project_model/src/sysroot.rs | |||
@@ -114,8 +114,12 @@ fn discover_sysroot_src_dir(current_dir: &AbsPath) -> Result<AbsPathBuf> { | |||
114 | if let Ok(path) = env::var("RUST_SRC_PATH") { | 114 | if let Ok(path) = env::var("RUST_SRC_PATH") { |
115 | let path = AbsPathBuf::try_from(path.as_str()) | 115 | let path = AbsPathBuf::try_from(path.as_str()) |
116 | .map_err(|path| format_err!("RUST_SRC_PATH must be absolute: {}", path.display()))?; | 116 | .map_err(|path| format_err!("RUST_SRC_PATH must be absolute: {}", path.display()))?; |
117 | log::debug!("Discovered sysroot by RUST_SRC_PATH: {}", path.display()); | 117 | let core = path.join("core"); |
118 | return Ok(path); | 118 | if core.exists() { |
119 | log::debug!("Discovered sysroot by RUST_SRC_PATH: {}", path.display()); | ||
120 | return Ok(path); | ||
121 | } | ||
122 | log::debug!("RUST_SRC_PATH is set, but is invalid (no core: {:?}), ignoring", core); | ||
119 | } | 123 | } |
120 | 124 | ||
121 | let sysroot_path = { | 125 | let sysroot_path = { |