Skip to content

Commit d99b17f

Browse files
committed
Remove the map field from Map
1 parent 072449c commit d99b17f

File tree

2 files changed

+0
-27
lines changed

2 files changed

+0
-27
lines changed

src/librustc/hir/map/mod.rs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,6 @@ pub struct Map<'hir> {
172172
pub(super) owner_map: FxHashMap<DefIndex, &'hir HirOwner<'hir>>,
173173
pub(super) owner_items_map: FxHashMap<DefIndex, &'hir HirOwnerItems<'hir>>,
174174

175-
pub(super) map: HirEntryMap<'hir>,
176-
177175
pub(super) definitions: &'hir Definitions,
178176

179177
/// The reverse mapping of `node_to_hir_id`.
@@ -220,27 +218,6 @@ impl<'hir> Map<'hir> {
220218
&self.krate
221219
}
222220

223-
#[inline]
224-
fn lookup(&self, id: HirId) -> Option<&Entry<'hir>> {
225-
let local_map = self.map.get(id.owner)?;
226-
local_map.get(id.local_id)?.as_ref()
227-
}
228-
229-
/// Registers a read in the dependency graph of the AST node with
230-
/// the given `id`. This needs to be called each time a public
231-
/// function returns the HIR for a node -- in other words, when it
232-
/// "reveals" the content of a node to the caller (who might not
233-
/// otherwise have had access to those contents, and hence needs a
234-
/// read recorded). If the function just returns a DefId or
235-
/// HirId, no actual content was returned, so no read is needed.
236-
pub fn read(&self, hir_id: HirId) {
237-
if let Some(entry) = self.lookup(hir_id) {
238-
self.dep_graph.read_index(entry.dep_node);
239-
} else {
240-
bug!("called `HirMap::read()` with invalid `HirId`: {:?}", hir_id)
241-
}
242-
}
243-
244221
#[inline]
245222
pub fn definitions(&self) -> &Definitions {
246223
&self.definitions
@@ -943,7 +920,6 @@ impl<'hir> Map<'hir> {
943920
/// Given a node ID, gets a list of attributes associated with the AST
944921
/// corresponding to the node-ID.
945922
pub fn attrs(&self, id: HirId) -> &'hir [ast::Attribute] {
946-
self.read(id); // reveals attributes on the node
947923
let attrs = match self.find_entry(id).map(|entry| entry.node) {
948924
Some(Node::Param(a)) => Some(&a.attrs[..]),
949925
Some(Node::Local(l)) => Some(&l.attrs[..]),
@@ -967,7 +943,6 @@ impl<'hir> Map<'hir> {
967943
}
968944

969945
pub fn span(&self, hir_id: HirId) -> Span {
970-
self.read(hir_id); // reveals span from node
971946
match self.find_entry(hir_id).map(|entry| entry.node) {
972947
Some(Node::Param(param)) => param.span,
973948
Some(Node::Item(item)) => item.span,

src/librustc/hir/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,6 @@ pub fn provide(providers: &mut Providers<'_>) {
107107
owner_map: early.owner_map,
108108
owner_items_map: early.owner_items_map,
109109

110-
map: early.map,
111-
112110
definitions: early.definitions,
113111

114112
hir_to_node_id: early.hir_to_node_id,

0 commit comments

Comments
 (0)