Store lowering outputs per owner.
This commit is contained in:
parent
f9e1de979d
commit
48a339ddbb
13 changed files with 170 additions and 125 deletions
|
@ -1994,7 +1994,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
|
|||
if ns == ValueNS {
|
||||
let item_name = path.last().unwrap().ident;
|
||||
let traits = self.traits_in_scope(item_name, ns);
|
||||
self.r.trait_map.as_mut().unwrap().insert(id, traits);
|
||||
self.r.trait_map.insert(id, traits);
|
||||
}
|
||||
|
||||
if PrimTy::from_name(path[0].ident.name).is_some() {
|
||||
|
@ -2479,12 +2479,12 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
|
|||
// the field name so that we can do some nice error reporting
|
||||
// later on in typeck.
|
||||
let traits = self.traits_in_scope(ident, ValueNS);
|
||||
self.r.trait_map.as_mut().unwrap().insert(expr.id, traits);
|
||||
self.r.trait_map.insert(expr.id, traits);
|
||||
}
|
||||
ExprKind::MethodCall(ref segment, ..) => {
|
||||
debug!("(recording candidate traits for expr) recording traits for {}", expr.id);
|
||||
let traits = self.traits_in_scope(segment.ident, ValueNS);
|
||||
self.r.trait_map.as_mut().unwrap().insert(expr.id, traits);
|
||||
self.r.trait_map.insert(expr.id, traits);
|
||||
}
|
||||
_ => {
|
||||
// Nothing to do.
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue