about summary refs log tree commit diff
diff options
context:
space:
mode:
authorZack M. Davis <code@zackmdavis.net>2018-01-31 20:40:03 -0800
committerZack M. Davis <code@zackmdavis.net>2018-01-31 20:40:03 -0800
commit8f9d91587fa1d2595405f8a1cc1c43e7b044be1a (patch)
tree1da401513e5477dda73ab71347e064f2eb2606f1
parent8ccab7eed5f4fc93500fbf242e575073ca70d7cb (diff)
downloadrust-8f9d91587fa1d2595405f8a1cc1c43e7b044be1a.tar.gz
rust-8f9d91587fa1d2595405f8a1cc1c43e7b044be1a.zip
in which HirIdMap is introduced as an affordance for using HirIds more
The glossaries in the draft rustc-guide book and librustc/README.md
state that `NodeId` is being gradually phased out in favor of `HirId`;
as such, the present author claims that we ought to have a typedef for
efficient `HirId` maps and sets in the module for such, even if no use
for them has been made as yet (compatibility constraints preventing the
use of it in the author's present unit of work): it is important to
create the psychological "affordance" (in James J. Gibson's sense) that
`HirId`s are a thing that compiler developers can work with.
-rw-r--r--src/librustc/util/nodemap.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/librustc/util/nodemap.rs b/src/librustc/util/nodemap.rs
index 674f67d5cd2..f98a8f834df 100644
--- a/src/librustc/util/nodemap.rs
+++ b/src/librustc/util/nodemap.rs
@@ -13,7 +13,7 @@
 #![allow(non_snake_case)]
 
 use hir::def_id::DefId;
-use hir::ItemLocalId;
+use hir::{HirId, ItemLocalId};
 use syntax::ast;
 
 pub use rustc_data_structures::fx::FxHashMap;
@@ -21,10 +21,12 @@ pub use rustc_data_structures::fx::FxHashSet;
 
 pub type NodeMap<T> = FxHashMap<ast::NodeId, T>;
 pub type DefIdMap<T> = FxHashMap<DefId, T>;
+pub type HirIdMap<T> = FxHashMap<HirId, T>;
 pub type ItemLocalMap<T> = FxHashMap<ItemLocalId, T>;
 
 pub type NodeSet = FxHashSet<ast::NodeId>;
 pub type DefIdSet = FxHashSet<DefId>;
+pub type HirIdSet = FxHashSet<HirId>;
 pub type ItemLocalSet = FxHashSet<ItemLocalId>;
 
 pub fn NodeMap<T>() -> NodeMap<T> { FxHashMap() }