Gather module items after lowering.

This commit is contained in:
Camille GILLOT 2021-07-18 18:12:17 +02:00
parent 0212c70b1d
commit fa6f5adf73
13 changed files with 121 additions and 69 deletions

View file

@ -21,7 +21,7 @@ use rustc_target::asm::InlineAsmRegOrRegClass;
use rustc_target::spec::abi::Abi;
use smallvec::SmallVec;
use std::collections::{BTreeMap, BTreeSet};
use std::collections::BTreeMap;
use std::fmt;
#[derive(Copy, Clone, Encodable, HashStable_Generic)]
@ -653,16 +653,6 @@ pub struct WhereEqPredicate<'hir> {
pub rhs_ty: &'hir Ty<'hir>,
}
#[derive(Default, Encodable, Debug, HashStable_Generic)]
pub struct ModuleItems {
// Use BTreeSets here so items are in the same order as in the
// list of all items in Crate
pub items: BTreeSet<ItemId>,
pub trait_items: BTreeSet<TraitItemId>,
pub impl_items: BTreeSet<ImplItemId>,
pub foreign_items: BTreeSet<ForeignItemId>,
}
/// The top-level data structure that stores the entire contents of
/// the crate currently being compiled.
///
@ -674,10 +664,6 @@ pub struct Crate<'hir> {
pub owners: IndexVec<LocalDefId, Option<OwnerNode<'hir>>>,
pub bodies: BTreeMap<BodyId, Body<'hir>>,
/// A list of modules written out in the order in which they
/// appear in the crate. This includes the main crate module.
pub modules: BTreeMap<LocalDefId, ModuleItems>,
/// Map indicating what traits are in scope for places where this
/// is relevant; generated by resolve.
pub trait_map: FxHashMap<LocalDefId, FxHashMap<ItemLocalId, Box<[TraitCandidate]>>>,