Skip to content

Commit 01c3ba8

Browse files
authored
Merge pull request rust-lang#19203 from lnicola/rust-src-path
minor: Switch back to RUST_SRC_PATH
2 parents f629e3e + db04df0 commit 01c3ba8

File tree

1 file changed

+6
-8
lines changed
  • src/tools/rust-analyzer/crates/project-model/src

1 file changed

+6
-8
lines changed

src/tools/rust-analyzer/crates/project-model/src/sysroot.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,8 @@ impl Sysroot {
312312
RustLibSrcWorkspace::Empty => true,
313313
};
314314
if !has_core {
315-
let var_note = if env::var_os("rust_lib_src_PATH").is_some() {
316-
" (env var `rust_lib_src_PATH` is set and may be incorrect, try unsetting it)"
315+
let var_note = if env::var_os("RUST_SRC_PATH").is_some() {
316+
" (env var `RUST_SRC_PATH` is set and may be incorrect, try unsetting it)"
317317
} else {
318318
", try running `rustup component add rust-src` to possibly fix this"
319319
};
@@ -422,18 +422,16 @@ fn discover_sysroot_dir(
422422
}
423423

424424
fn discover_rust_lib_src_dir(sysroot_path: &AbsPathBuf) -> Option<AbsPathBuf> {
425-
if let Ok(path) = env::var("rust_lib_src_PATH") {
425+
if let Ok(path) = env::var("RUST_SRC_PATH") {
426426
if let Ok(path) = AbsPathBuf::try_from(path.as_str()) {
427427
let core = path.join("core");
428428
if fs::metadata(&core).is_ok() {
429-
tracing::debug!("Discovered sysroot by rust_lib_src_PATH: {path}");
429+
tracing::debug!("Discovered sysroot by RUST_SRC_PATH: {path}");
430430
return Some(path);
431431
}
432-
tracing::debug!(
433-
"rust_lib_src_PATH is set, but is invalid (no core: {core:?}), ignoring"
434-
);
432+
tracing::debug!("RUST_SRC_PATH is set, but is invalid (no core: {core:?}), ignoring");
435433
} else {
436-
tracing::debug!("rust_lib_src_PATH is set, but is invalid, ignoring");
434+
tracing::debug!("RUST_SRC_PATH is set, but is invalid, ignoring");
437435
}
438436
}
439437

0 commit comments

Comments
 (0)