about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLaurențiu Nicola <lnicola@dend.ro>2025-02-22 09:07:52 +0200
committerLaurențiu Nicola <lnicola@dend.ro>2025-02-22 09:07:52 +0200
commitdb04df096f6e6b13e526ce4522c727a6416ac016 (patch)
tree58e10802a2f2894bc7049260c077dbe58c3faf0b
parent010cba398d02f1b7e047b60f92f8ed48efb6fc16 (diff)
downloadrust-db04df096f6e6b13e526ce4522c727a6416ac016.tar.gz
rust-db04df096f6e6b13e526ce4522c727a6416ac016.zip
Switch back to RUST_SRC_PATH
-rw-r--r--src/tools/rust-analyzer/crates/project-model/src/sysroot.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/tools/rust-analyzer/crates/project-model/src/sysroot.rs b/src/tools/rust-analyzer/crates/project-model/src/sysroot.rs
index 544ba43ba66..fb752fe47b3 100644
--- a/src/tools/rust-analyzer/crates/project-model/src/sysroot.rs
+++ b/src/tools/rust-analyzer/crates/project-model/src/sysroot.rs
@@ -312,8 +312,8 @@ impl Sysroot {
                     RustLibSrcWorkspace::Empty => true,
                 };
                 if !has_core {
-                    let var_note = if env::var_os("rust_lib_src_PATH").is_some() {
-                        " (env var `rust_lib_src_PATH` is set and may be incorrect, try unsetting it)"
+                    let var_note = if env::var_os("RUST_SRC_PATH").is_some() {
+                        " (env var `RUST_SRC_PATH` is set and may be incorrect, try unsetting it)"
                     } else {
                         ", try running `rustup component add rust-src` to possibly fix this"
                     };
@@ -422,18 +422,16 @@ fn discover_sysroot_dir(
 }
 
 fn discover_rust_lib_src_dir(sysroot_path: &AbsPathBuf) -> Option<AbsPathBuf> {
-    if let Ok(path) = env::var("rust_lib_src_PATH") {
+    if let Ok(path) = env::var("RUST_SRC_PATH") {
         if let Ok(path) = AbsPathBuf::try_from(path.as_str()) {
             let core = path.join("core");
             if fs::metadata(&core).is_ok() {
-                tracing::debug!("Discovered sysroot by rust_lib_src_PATH: {path}");
+                tracing::debug!("Discovered sysroot by RUST_SRC_PATH: {path}");
                 return Some(path);
             }
-            tracing::debug!(
-                "rust_lib_src_PATH is set, but is invalid (no core: {core:?}), ignoring"
-            );
+            tracing::debug!("RUST_SRC_PATH is set, but is invalid (no core: {core:?}), ignoring");
         } else {
-            tracing::debug!("rust_lib_src_PATH is set, but is invalid, ignoring");
+            tracing::debug!("RUST_SRC_PATH is set, but is invalid, ignoring");
         }
     }