Skip to content

Commit

Permalink
Merge pull request #1135 from xuyizhe/rust-src-path
Browse files Browse the repository at this point in the history
Fix the default value of RUST_SRC_PATH
  • Loading branch information
kngwyu authored Oct 15, 2020
2 parents 7a7726a + 313c392 commit 3bcf543
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/racer/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,16 +451,16 @@ fn check_rust_sysroot() -> Option<path::PathBuf> {
if let Ok(output) = cmd.output() {
if let Ok(s) = String::from_utf8(output.stdout) {
let sysroot = path::Path::new(s.trim());
let srcpath = sysroot.join("lib/rustlib/src/rust/src");
if srcpath.exists() {
return Some(srcpath);
}
// See if the toolchain is sufficiently new, after the libstd
// has been internally reorganized
let srcpath = sysroot.join("lib/rustlib/src/rust/library");
if srcpath.exists() {
return Some(srcpath);
}
let srcpath = sysroot.join("lib/rustlib/src/rust/src");
if srcpath.exists() {
return Some(srcpath);
}
}
}
None
Expand Down Expand Up @@ -545,7 +545,6 @@ fn validate_rust_src_path(path: path::PathBuf) -> Result<path::PathBuf, RustSrcP
if path.join("libstd").exists() || path.join("std").join("src").exists() {
Ok(path)
} else {

Err(RustSrcPathError::NotRustSourceTree(path.join("libstd")))
}
}
Expand Down

0 comments on commit 3bcf543

Please sign in to comment.