Skip to content

Commit a9ec0fa

Browse files
committed
Update get_parent_node
1 parent 74bf0d5 commit a9ec0fa

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
@@ -584,12 +584,11 @@ impl<'hir> Map<'hir> {
584584

585585
/// Retrieves the `Node` corresponding to `id`, panicking if it cannot be found.
586586
pub fn get(&self, id: HirId) -> Node<'hir> {
587-
// read recorded by `find`
588587
self.find(id).unwrap_or_else(|| bug!("couldn't find hir id {} in the HIR map", id))
589588
}
590589

591590
pub fn get_if_local(&self, id: DefId) -> Option<Node<'hir>> {
592-
self.as_local_hir_id(id).map(|id| self.get(id)) // read recorded by `get`
591+
self.as_local_hir_id(id).map(|id| self.get(id))
593592
}
594593

595594
pub fn get_generics(&self, id: DefId) -> Option<&'hir Generics<'hir>> {
@@ -633,13 +632,7 @@ impl<'hir> Map<'hir> {
633632
/// from a node to the root of the HIR (unless you get back the same ID here,
634633
/// which can happen if the ID is not in the map itself or is just weird).
635634
pub fn get_parent_node(&self, hir_id: HirId) -> HirId {
636-
if self.dep_graph.is_fully_enabled() {
637-
let hir_id_owner = hir_id.owner;
638-
let def_path_hash = self.definitions.def_path_hash(hir_id_owner);
639-
self.dep_graph.read(DepNode::from_def_path_hash(def_path_hash, DepKind::HirBody));
640-
}
641-
642-
self.find_entry(hir_id).and_then(|x| x.parent_node()).unwrap_or(hir_id)
635+
self.get_entry(hir_id).parent_node().unwrap_or(hir_id)
643636
}
644637

645638
/// Checks if the node is an argument. An argument is a local variable whose

0 commit comments

Comments
 (0)