Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/project_model/src/sysroot.rs')
-rw-r--r--crates/project_model/src/sysroot.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/crates/project_model/src/sysroot.rs b/crates/project_model/src/sysroot.rs
index 6c17492948..153cbc1c84 100644
--- a/crates/project_model/src/sysroot.rs
+++ b/crates/project_model/src/sysroot.rs
@@ -4,7 +4,7 @@
//! but we can't process `.rlib` and need source code instead. The source code
//! is typically installed with `rustup component add rust-src` command.
-use std::{convert::TryFrom, env, fs, ops, path::PathBuf, process::Command};
+use std::{convert::TryFrom, env, fs, iter, ops, path::PathBuf, process::Command};
use anyhow::{format_err, Result};
use la_arena::{Arena, Idx};
@@ -39,10 +39,15 @@ impl Sysroot {
&self.root
}
- pub fn public_deps(&self) -> impl Iterator<Item = (&'static str, SysrootCrate)> + '_ {
+ pub fn public_deps(&self) -> impl Iterator<Item = (&'static str, SysrootCrate, bool)> + '_ {
// core is added as a dependency before std in order to
// mimic rustcs dependency order
- ["core", "alloc", "std"].iter().filter_map(move |&it| Some((it, self.by_name(it)?)))
+ ["core", "alloc", "std"]
+ .iter()
+ .copied()
+ .zip(iter::repeat(true))
+ .chain(iter::once(("test", false)))
+ .filter_map(move |(name, prelude)| Some((name, self.by_name(name)?, prelude)))
}
pub fn proc_macro(&self) -> Option<SysrootCrate> {