diff options
Diffstat (limited to 'crates/project_model/src')
-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 = { |