Skip to content

Commit fde0ca5

Browse files
incr.comp.: Add some missing reads in HIR map.
1 parent 616b455 commit fde0ca5

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/librustc/hir/map/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,12 @@ impl<'hir> Map<'hir> {
416416
/// if the node is a body owner, otherwise returns `None`.
417417
pub fn maybe_body_owned_by(&self, id: NodeId) -> Option<BodyId> {
418418
if let Some(entry) = self.find_entry(id) {
419+
if self.dep_graph.is_fully_enabled() {
420+
let hir_id_owner = self.node_to_hir_id(id).owner;
421+
let def_path_hash = self.definitions.def_path_hash(hir_id_owner);
422+
self.dep_graph.read(def_path_hash.to_dep_node(DepKind::HirBody));
423+
}
424+
419425
if let Some(body_id) = entry.associated_body() {
420426
// For item-like things and closures, the associated
421427
// body has its own distinct id, and that is returned
@@ -530,6 +536,12 @@ impl<'hir> Map<'hir> {
530536
/// from a node to the root of the ast (unless you get the same id back here
531537
/// that can happen if the id is not in the map itself or is just weird).
532538
pub fn get_parent_node(&self, id: NodeId) -> NodeId {
539+
if self.dep_graph.is_fully_enabled() {
540+
let hir_id_owner = self.node_to_hir_id(id).owner;
541+
let def_path_hash = self.definitions.def_path_hash(hir_id_owner);
542+
self.dep_graph.read(def_path_hash.to_dep_node(DepKind::HirBody));
543+
}
544+
533545
self.find_entry(id).and_then(|x| x.parent_node()).unwrap_or(id)
534546
}
535547

0 commit comments

Comments
 (0)