Skip to content

Commit 3bcf543

Browse files
authored
Merge pull request #1135 from xuyizhe/rust-src-path
Fix the default value of RUST_SRC_PATH
2 parents 7a7726a + 313c392 commit 3bcf543

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/racer/util.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -451,16 +451,16 @@ fn check_rust_sysroot() -> Option<path::PathBuf> {
451451
if let Ok(output) = cmd.output() {
452452
if let Ok(s) = String::from_utf8(output.stdout) {
453453
let sysroot = path::Path::new(s.trim());
454-
let srcpath = sysroot.join("lib/rustlib/src/rust/src");
455-
if srcpath.exists() {
456-
return Some(srcpath);
457-
}
458454
// See if the toolchain is sufficiently new, after the libstd
459455
// has been internally reorganized
460456
let srcpath = sysroot.join("lib/rustlib/src/rust/library");
461457
if srcpath.exists() {
462458
return Some(srcpath);
463459
}
460+
let srcpath = sysroot.join("lib/rustlib/src/rust/src");
461+
if srcpath.exists() {
462+
return Some(srcpath);
463+
}
464464
}
465465
}
466466
None
@@ -545,7 +545,6 @@ fn validate_rust_src_path(path: path::PathBuf) -> Result<path::PathBuf, RustSrcP
545545
if path.join("libstd").exists() || path.join("std").join("src").exists() {
546546
Ok(path)
547547
} else {
548-
549548
Err(RustSrcPathError::NotRustSourceTree(path.join("libstd")))
550549
}
551550
}

0 commit comments

Comments
 (0)