mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 21:35:20 +00:00
7643: Automatically detect the rustc-src directory (fixes #3517) r=matklad a=bnjbvr If the configured rustcSource was not set, then try to automatically detect a source for the sysroot rustc directory. I wasn't sure how to do it in the case of the project.json file, though. 7663: Tolerate spaces in nix binary patching r=matklad a=CertainLach If path to original file contains space (I.e on code insiders, where default data directory is ~/Code - Insiders/), then there is syntax error evaluating src arg. Instead pass path as str, and coerce to path back in nix expression Co-authored-by: Benjamin Bouvier <public@benj.me> Co-authored-by: Yaroslav Bolyukin <iam@lach.pw>
This commit is contained in:
commit
d50a37d3aa
8 changed files with 70 additions and 23 deletions
|
@ -18,7 +18,7 @@ use ide_db::helpers::{
|
|||
};
|
||||
use itertools::Itertools;
|
||||
use lsp_types::{ClientCapabilities, MarkupKind};
|
||||
use project_model::{CargoConfig, ProjectJson, ProjectJsonData, ProjectManifest};
|
||||
use project_model::{CargoConfig, ProjectJson, ProjectJsonData, ProjectManifest, RustcSource};
|
||||
use rustc_hash::FxHashSet;
|
||||
use serde::{de::DeserializeOwned, Deserialize};
|
||||
use vfs::AbsPathBuf;
|
||||
|
@ -177,8 +177,9 @@ config_data! {
|
|||
/// tests or binaries.\nFor example, it may be `--release`.
|
||||
runnables_cargoExtraArgs: Vec<String> = "[]",
|
||||
|
||||
/// Path to the rust compiler sources, for usage in rustc_private projects.
|
||||
rustcSource : Option<PathBuf> = "null",
|
||||
/// Path to the rust compiler sources, for usage in rustc_private projects, or "discover"
|
||||
/// to try to automatically find it.
|
||||
rustcSource : Option<String> = "null",
|
||||
|
||||
/// Additional arguments to `rustfmt`.
|
||||
rustfmt_extraArgs: Vec<String> = "[]",
|
||||
|
@ -473,7 +474,13 @@ impl Config {
|
|||
self.data.cargo_loadOutDirsFromCheck
|
||||
}
|
||||
pub fn cargo(&self) -> CargoConfig {
|
||||
let rustc_source = self.data.rustcSource.as_ref().map(|it| self.root_path.join(&it));
|
||||
let rustc_source = self.data.rustcSource.as_ref().map(|rustc_src| {
|
||||
if rustc_src == "discover" {
|
||||
RustcSource::Discover
|
||||
} else {
|
||||
RustcSource::Path(self.root_path.join(rustc_src))
|
||||
}
|
||||
});
|
||||
|
||||
CargoConfig {
|
||||
no_default_features: self.data.cargo_noDefaultFeatures,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue