Skip to content

Commit d5827d8

Browse files
committed
Update get_parent_node
1 parent b40e6ba commit d5827d8

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/librustc/hir/map/mod.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -579,12 +579,11 @@ impl<'hir> Map<'hir> {
579579

580580
/// Retrieves the `Node` corresponding to `id`, panicking if it cannot be found.
581581
pub fn get(&self, id: HirId) -> Node<'hir> {
582-
// read recorded by `find`
583582
self.find(id).unwrap_or_else(|| bug!("couldn't find hir id {} in the HIR map", id))
584583
}
585584

586585
pub fn get_if_local(&self, id: DefId) -> Option<Node<'hir>> {
587-
self.as_local_hir_id(id).map(|id| self.get(id)) // read recorded by `get`
586+
self.as_local_hir_id(id).map(|id| self.get(id))
588587
}
589588

590589
pub fn get_generics(&self, id: DefId) -> Option<&'hir Generics<'hir>> {
@@ -628,13 +627,7 @@ impl<'hir> Map<'hir> {
628627
/// from a node to the root of the HIR (unless you get back the same ID here,
629628
/// which can happen if the ID is not in the map itself or is just weird).
630629
pub fn get_parent_node(&self, hir_id: HirId) -> HirId {
631-
if self.dep_graph.is_fully_enabled() {
632-
let hir_id_owner = hir_id.owner;
633-
let def_path_hash = self.definitions.def_path_hash(hir_id_owner);
634-
self.dep_graph.read(DepNode::from_def_path_hash(def_path_hash, DepKind::HirBody));
635-
}
636-
637-
self.find_entry(hir_id).and_then(|x| x.parent_node()).unwrap_or(hir_id)
630+
self.get_entry(hir_id).parent_node().unwrap_or(hir_id)
638631
}
639632

640633
/// Returns an iterator for the nodes in the ancestor tree of the `current_id`

0 commit comments

Comments
 (0)