Skip to content

Commit 8f9d915

Browse files
committed
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.
1 parent 8ccab7e commit 8f9d915

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/librustc/util/nodemap.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,20 @@
1313
#![allow(non_snake_case)]
1414

1515
use hir::def_id::DefId;
16-
use hir::ItemLocalId;
16+
use hir::{HirId, ItemLocalId};
1717
use syntax::ast;
1818

1919
pub use rustc_data_structures::fx::FxHashMap;
2020
pub use rustc_data_structures::fx::FxHashSet;
2121

2222
pub type NodeMap<T> = FxHashMap<ast::NodeId, T>;
2323
pub type DefIdMap<T> = FxHashMap<DefId, T>;
24+
pub type HirIdMap<T> = FxHashMap<HirId, T>;
2425
pub type ItemLocalMap<T> = FxHashMap<ItemLocalId, T>;
2526

2627
pub type NodeSet = FxHashSet<ast::NodeId>;
2728
pub type DefIdSet = FxHashSet<DefId>;
29+
pub type HirIdSet = FxHashSet<HirId>;
2830
pub type ItemLocalSet = FxHashSet<ItemLocalId>;
2931

3032
pub fn NodeMap<T>() -> NodeMap<T> { FxHashMap() }

0 commit comments

Comments
 (0)