Implicitly depend on test

This commit is contained in:
Jonas Schievink 2021-09-28 21:39:41 +02:00
parent 0b76b29512
commit 0e6922f8a8
3 changed files with 61 additions and 23 deletions

View file

@ -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> {