Merge pull request #1294 from dbarrosop/nix-darwin

fix nix environment
This commit is contained in:
liv
2023-01-03 10:20:47 +01:00
committed by GitHub
2 changed files with 19 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
use glob::glob;
use serde::{Deserialize, Serialize};
use std::env;
use std::error::Error;
use std::process::Command;
@@ -64,6 +65,12 @@ impl RustAnalyzerProject {
/// Use `rustc` to determine the default toolchain
pub fn get_sysroot_src(&mut self) -> Result<(), Box<dyn Error>> {
// check if RUST_SRC_PATH is set
if let Ok(path) = env::var("RUST_SRC_PATH") {
self.sysroot_src = path;
return Ok(());
}
let toolchain = Command::new("rustc")
.arg("--print")
.arg("sysroot")