2381: Add proc-macro crate type handling r=JasperDeSutter a=JasperDeSutter

Resolves the libproc_macro crate in crates that are the proc-macro type.
This doesn't seem the ideal implementation though, since the compiler still requires you to write `extern crate proc_macro;` (even in 2018 edition).

Co-authored-by: JasperDeSutter <jasper.desutter@gmail.com>
This commit is contained in:
bors[bot] 2019-11-24 15:59:47 +00:00 committed by GitHub
commit b0581c2403
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 1 deletions

View file

@ -39,6 +39,10 @@ impl Sysroot {
self.by_name("std")
}
pub fn proc_macro(&self) -> Option<SysrootCrate> {
self.by_name("proc_macro")
}
pub fn crates<'a>(&'a self) -> impl Iterator<Item = SysrootCrate> + ExactSizeIterator + 'a {
self.crates.iter().map(|(id, _data)| id)
}
@ -74,7 +78,7 @@ impl Sysroot {
}
}
if let Some(alloc) = sysroot.by_name("alloc") {
if let Some(core) = sysroot.by_name("core") {
if let Some(core) = sysroot.core() {
sysroot.crates[alloc].deps.push(core);
}
}