]> git.lizzy.rs Git - rust.git/commitdiff
Remove the `map` field from `Map`
authorJohn Kåre Alsaker <john.kare.alsaker@gmail.com>
Sat, 8 Feb 2020 03:24:42 +0000 (04:24 +0100)
committerJohn Kåre Alsaker <john.kare.alsaker@gmail.com>
Sat, 14 Mar 2020 21:52:29 +0000 (22:52 +0100)
src/librustc/hir/map/mod.rs
src/librustc/hir/mod.rs

index 1a816e6b2cbed57fa5ff6159d27792dc8a260325..7604aeb8766261341b704e70b8e77885f30ecc23 100644 (file)
@@ -172,8 +172,6 @@ pub struct Map<'hir> {
     pub(super) owner_map: FxHashMap<DefIndex, &'hir HirOwner<'hir>>,
     pub(super) owner_items_map: FxHashMap<DefIndex, &'hir HirOwnerItems<'hir>>,
 
-    pub(super) map: HirEntryMap<'hir>,
-
     pub(super) definitions: &'hir Definitions,
 
     /// The reverse mapping of `node_to_hir_id`.
@@ -220,27 +218,6 @@ pub fn untracked_krate(&self) -> &Crate<'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 @@ pub fn name(&self, id: HirId) -> Name {
     /// 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 @@ pub fn attrs(&self, id: HirId) -> &'hir [ast::Attribute] {
     }
 
     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,
index f113efa6300925d052c059141ac90c5ad75b2e4c..34cfff999a71cefb9eb441537a40c06310d0a622 100644 (file)
@@ -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,