Store lowering outputs per owner.

This commit is contained in:
Camille GILLOT 2021-07-16 14:42:26 +02:00
parent f9e1de979d
commit 48a339ddbb
13 changed files with 170 additions and 125 deletions

View file

@ -930,7 +930,7 @@ pub struct Resolver<'a> {
/// `CrateNum` resolutions of `extern crate` items.
extern_crate_map: FxHashMap<LocalDefId, CrateNum>,
export_map: ExportMap,
trait_map: Option<NodeMap<Vec<TraitCandidate>>>,
trait_map: NodeMap<Vec<TraitCandidate>>,
/// A map from nodes to anonymous modules.
/// Anonymous modules are pseudo-modules that are implicitly created around items
@ -1185,8 +1185,8 @@ impl ResolverAstLowering for Resolver<'_> {
self.next_node_id()
}
fn take_trait_map(&mut self) -> NodeMap<Vec<TraitCandidate>> {
std::mem::replace(&mut self.trait_map, None).unwrap()
fn take_trait_map(&mut self, node: NodeId) -> Option<Vec<TraitCandidate>> {
self.trait_map.remove(&node)
}
fn opt_local_def_id(&self, node: NodeId) -> Option<LocalDefId> {
@ -1363,7 +1363,7 @@ impl<'a> Resolver<'a> {
label_res_map: Default::default(),
extern_crate_map: Default::default(),
export_map: FxHashMap::default(),
trait_map: Some(NodeMap::default()),
trait_map: NodeMap::default(),
underscore_disambiguator: 0,
empty_module,
module_map,