mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
special case std
This commit is contained in:
parent
8852408bfb
commit
e35374ec7c
@ -25,7 +25,11 @@ struct SysrootCrateData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Sysroot {
|
impl Sysroot {
|
||||||
pub(crate) fn discover(cargo_toml: &Path) -> Result<Sysroot> {
|
pub(crate) fn std(&self) -> Option<SysrootCrate> {
|
||||||
|
self.by_name("std")
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) fn discover(cargo_toml: &Path) -> Result<Sysroot> {
|
||||||
let rustc_output = Command::new("rustc")
|
let rustc_output = Command::new("rustc")
|
||||||
.current_dir(cargo_toml.parent().unwrap())
|
.current_dir(cargo_toml.parent().unwrap())
|
||||||
.args(&["--print", "sysroot"])
|
.args(&["--print", "sysroot"])
|
||||||
@ -50,7 +54,7 @@ impl Sysroot {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(std) = sysroot.by_name("std") {
|
if let Some(std) = sysroot.std() {
|
||||||
for dep in STD_DEPS.trim().lines() {
|
for dep in STD_DEPS.trim().lines() {
|
||||||
if let Some(dep) = sysroot.by_name(dep) {
|
if let Some(dep) = sysroot.by_name(dep) {
|
||||||
sysroot.crates[std].deps.push(dep)
|
sysroot.crates[std].deps.push(dep)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user