make distinct Hir() nodes in the graph for impl items
This commit is contained in:
parent
3fd67eba87
commit
eeb45c7591
@ -47,13 +47,12 @@ pub fn visit_all_item_likes_in_krate<'a, 'tcx, V, F>(tcx: TyCtxt<'a, 'tcx, 'tcx>
|
||||
}
|
||||
|
||||
fn visit_impl_item(&mut self, i: &'tcx hir::ImplItem) {
|
||||
// TODO -- use the def-id of the impl for now
|
||||
let impl_def_id = self.tcx.map.get_parent_did(i.id);
|
||||
let task_id = (self.dep_node_fn)(impl_def_id);
|
||||
let impl_item_def_id = self.tcx.map.local_def_id(i.id);
|
||||
let task_id = (self.dep_node_fn)(impl_item_def_id);
|
||||
let _task = self.tcx.dep_graph.in_task(task_id.clone());
|
||||
debug!("Started task {:?}", task_id);
|
||||
assert!(!self.tcx.map.is_inlined_def_id(impl_def_id));
|
||||
self.tcx.dep_graph.read(DepNode::Hir(impl_def_id));
|
||||
assert!(!self.tcx.map.is_inlined_def_id(impl_item_def_id));
|
||||
self.tcx.dep_graph.read(DepNode::Hir(impl_item_def_id));
|
||||
self.visitor.visit_impl_item(i);
|
||||
debug!("Ended task {:?}", task_id);
|
||||
}
|
||||
|
@ -254,9 +254,14 @@ impl<'ast> Map<'ast> {
|
||||
return DepNode::Hir(def_id);
|
||||
}
|
||||
|
||||
EntryImplItem(..) => {
|
||||
let def_id = self.local_def_id(id);
|
||||
assert!(!self.is_inlined_def_id(def_id));
|
||||
return DepNode::Hir(def_id);
|
||||
}
|
||||
|
||||
EntryForeignItem(p, _) |
|
||||
EntryTraitItem(p, _) |
|
||||
EntryImplItem(p, _) |
|
||||
EntryVariant(p, _) |
|
||||
EntryExpr(p, _) |
|
||||
EntryStmt(p, _) |
|
||||
@ -379,7 +384,6 @@ impl<'ast> Map<'ast> {
|
||||
}
|
||||
|
||||
pub fn impl_item(&self, id: ImplItemId) -> &'ast ImplItem {
|
||||
// TODO right now this triggers a read of the whole impl
|
||||
self.read(id.id);
|
||||
|
||||
// NB: intentionally bypass `self.forest.krate()` so that we
|
||||
|
@ -207,6 +207,11 @@ impl<'a, 'tcx> Visitor<'tcx> for HashItemsVisitor<'a, 'tcx> {
|
||||
visit::walk_item(self, item);
|
||||
}
|
||||
|
||||
fn visit_impl_item(&mut self, impl_item: &'tcx hir::ImplItem) {
|
||||
self.calculate_node_id(impl_item.id, |v| v.visit_impl_item(impl_item));
|
||||
visit::walk_impl_item(self, impl_item);
|
||||
}
|
||||
|
||||
fn visit_foreign_item(&mut self, item: &'tcx hir::ForeignItem) {
|
||||
self.calculate_node_id(item.id, |v| v.visit_foreign_item(item));
|
||||
visit::walk_foreign_item(self, item);
|
||||
|
@ -503,10 +503,8 @@ impl<'a, 'hash, 'tcx> visit::Visitor<'tcx> for StrictVersionHashVisitor<'a, 'has
|
||||
// Each item is hashed independently; ignore nested items.
|
||||
}
|
||||
|
||||
fn visit_nested_impl_item(&mut self, impl_item_id: ImplItemId) {
|
||||
// For now, we hash impl items as part of the containing impl.
|
||||
let impl_item = self.tcx.map.impl_item(impl_item_id);
|
||||
self.visit_impl_item(impl_item);
|
||||
fn visit_nested_impl_item(&mut self, _: ImplItemId) {
|
||||
// Impl items are hashed independently; ignore nested impl items.
|
||||
}
|
||||
|
||||
fn visit_variant_data(&mut self,
|
||||
|
Loading…
x
Reference in New Issue
Block a user