From 8f9d91587fa1d2595405f8a1cc1c43e7b044be1a Mon Sep 17 00:00:00 2001 From: "Zack M. Davis" Date: Wed, 31 Jan 2018 20:40:03 -0800 Subject: [PATCH] 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. --- src/librustc/util/nodemap.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/librustc/util/nodemap.rs b/src/librustc/util/nodemap.rs index 674f67d5cd2f..f98a8f834df8 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 = FxHashMap; pub type DefIdMap = FxHashMap; +pub type HirIdMap = FxHashMap; pub type ItemLocalMap = FxHashMap; pub type NodeSet = FxHashSet; pub type DefIdSet = FxHashSet; +pub type HirIdSet = FxHashSet; pub type ItemLocalSet = FxHashSet; pub fn NodeMap() -> NodeMap { FxHashMap() }