Auto merge of #88703 - cjgillot:lazymod, r=petrochenkov
Gather module items after lowering. This avoids having a non-local analysis inside lowering. By implementing `hir_module_items` using a visitor, we make sure that iterations and visitors are consistent.
This commit is contained in:
commit
7b5f95270f
14 changed files with 147 additions and 83 deletions
|
@ -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]>>>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue