From d99b17fa6478e1c7d55c95938e90467ae0e2ab2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Sat, 8 Feb 2020 04:24:42 +0100 Subject: [PATCH] Remove the `map` field from `Map` --- src/librustc/hir/map/mod.rs | 25 ------------------------- src/librustc/hir/mod.rs | 2 -- 2 files changed, 27 deletions(-) diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index 1a816e6b2cb..7604aeb8766 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -172,8 +172,6 @@ pub struct Map<'hir> { pub(super) owner_map: FxHashMap>, pub(super) owner_items_map: FxHashMap>, - pub(super) map: HirEntryMap<'hir>, - pub(super) definitions: &'hir Definitions, /// The reverse mapping of `node_to_hir_id`. @@ -220,27 +218,6 @@ impl<'hir> Map<'hir> { &self.krate } - #[inline] - fn lookup(&self, id: HirId) -> Option<&Entry<'hir>> { - let local_map = self.map.get(id.owner)?; - local_map.get(id.local_id)?.as_ref() - } - - /// Registers a read in the dependency graph of the AST node with - /// the given `id`. This needs to be called each time a public - /// function returns the HIR for a node -- in other words, when it - /// "reveals" the content of a node to the caller (who might not - /// otherwise have had access to those contents, and hence needs a - /// read recorded). If the function just returns a DefId or - /// HirId, no actual content was returned, so no read is needed. - pub fn read(&self, hir_id: HirId) { - if let Some(entry) = self.lookup(hir_id) { - self.dep_graph.read_index(entry.dep_node); - } else { - bug!("called `HirMap::read()` with invalid `HirId`: {:?}", hir_id) - } - } - #[inline] pub fn definitions(&self) -> &Definitions { &self.definitions @@ -943,7 +920,6 @@ impl<'hir> Map<'hir> { /// Given a node ID, gets a list of attributes associated with the AST /// corresponding to the node-ID. pub fn attrs(&self, id: HirId) -> &'hir [ast::Attribute] { - self.read(id); // reveals attributes on the node let attrs = match self.find_entry(id).map(|entry| entry.node) { Some(Node::Param(a)) => Some(&a.attrs[..]), Some(Node::Local(l)) => Some(&l.attrs[..]), @@ -967,7 +943,6 @@ impl<'hir> Map<'hir> { } pub fn span(&self, hir_id: HirId) -> Span { - self.read(hir_id); // reveals span from node match self.find_entry(hir_id).map(|entry| entry.node) { Some(Node::Param(param)) => param.span, Some(Node::Item(item)) => item.span, diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index f113efa6300..34cfff999a7 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -107,8 +107,6 @@ pub fn provide(providers: &mut Providers<'_>) { owner_map: early.owner_map, owner_items_map: early.owner_items_map, - map: early.map, - definitions: early.definitions, hir_to_node_id: early.hir_to_node_id,