mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
more generic, find rustc as well
This commit is contained in:
parent
ffaef1b7ae
commit
5aa1bba107
4 changed files with 71 additions and 54 deletions
|
@ -1,5 +1,6 @@
|
|||
//! FIXME: write short doc here
|
||||
|
||||
use super::find_executables::get_path_for_executable;
|
||||
use anyhow::{bail, Context, Result};
|
||||
use std::{
|
||||
env, ops,
|
||||
|
@ -114,7 +115,8 @@ fn get_or_install_rust_src(cargo_toml: &Path) -> Result<PathBuf> {
|
|||
if let Ok(path) = env::var("RUST_SRC_PATH") {
|
||||
return Ok(path.into());
|
||||
}
|
||||
let rustc_output = run_command_in_cargo_dir(cargo_toml, "rustc", &["--print", "sysroot"])?;
|
||||
let rustc = get_path_for_executable("rustc")?;
|
||||
let rustc_output = run_command_in_cargo_dir(cargo_toml, &rustc, &["--print", "sysroot"])?;
|
||||
let stdout = String::from_utf8(rustc_output.stdout)?;
|
||||
let sysroot_path = Path::new(stdout.trim());
|
||||
let src_path = sysroot_path.join("lib/rustlib/src/rust/src");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue