From e3f8e7d13d01fcdd1bb0f31887d1f72fc44c4d4e Mon Sep 17 00:00:00 2001 From: Marco Groppo Date: Sun, 24 Nov 2019 13:19:47 +0100 Subject: Add alloc to the sysroot --- crates/ra_project_model/src/lib.rs | 6 ++++++ crates/ra_project_model/src/sysroot.rs | 4 ++++ 2 files changed, 10 insertions(+) (limited to 'crates') diff --git a/crates/ra_project_model/src/lib.rs b/crates/ra_project_model/src/lib.rs index d04a8cbe2..638ca2f8b 100644 --- a/crates/ra_project_model/src/lib.rs +++ b/crates/ra_project_model/src/lib.rs @@ -209,6 +209,7 @@ impl ProjectWorkspace { } let libcore = sysroot.core().and_then(|it| sysroot_crates.get(&it).copied()); + let liballoc = sysroot.alloc().and_then(|it| sysroot_crates.get(&it).copied()); let libstd = sysroot.std().and_then(|it| sysroot_crates.get(&it).copied()); let mut pkg_to_lib_crate = FxHashMap::default(); @@ -261,6 +262,11 @@ impl ProjectWorkspace { log::error!("cyclic dependency on core for {}", pkg.name(&cargo)) } } + if let Some(alloc) = liballoc { + if let Err(_) = crate_graph.add_dep(from, "alloc".into(), alloc) { + log::error!("cyclic dependency on alloc for {}", pkg.name(&cargo)) + } + } if let Some(std) = libstd { if let Err(_) = crate_graph.add_dep(from, "std".into(), std) { log::error!("cyclic dependency on std for {}", pkg.name(&cargo)) diff --git a/crates/ra_project_model/src/sysroot.rs b/crates/ra_project_model/src/sysroot.rs index 3d827809e..bec9439d7 100644 --- a/crates/ra_project_model/src/sysroot.rs +++ b/crates/ra_project_model/src/sysroot.rs @@ -31,6 +31,10 @@ impl Sysroot { self.by_name("core") } + pub fn alloc(&self) -> Option { + self.by_name("alloc") + } + pub fn std(&self) -> Option { self.by_name("std") } -- cgit v1.2.3