define_id_collections -> rustc_data_structures
This commit is contained in:
parent
7901c7f707
commit
f507403517
2 changed files with 9 additions and 6 deletions
|
@ -4,12 +4,7 @@ use crate::hir::def_id::DefId;
|
||||||
use crate::hir::{HirId, ItemLocalId};
|
use crate::hir::{HirId, ItemLocalId};
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
|
|
||||||
macro_rules! define_id_collections {
|
use rustc_data_structures::define_id_collections;
|
||||||
($map_name:ident, $set_name:ident, $key:ty) => {
|
|
||||||
pub type $map_name<T> = rustc_data_structures::fx::FxHashMap<$key, T>;
|
|
||||||
pub type $set_name = rustc_data_structures::fx::FxHashSet<$key>;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
define_id_collections!(NodeMap, NodeSet, ast::NodeId);
|
define_id_collections!(NodeMap, NodeSet, ast::NodeId);
|
||||||
define_id_collections!(DefIdMap, DefIdSet, DefId);
|
define_id_collections!(DefIdMap, DefIdSet, DefId);
|
||||||
|
|
|
@ -4,3 +4,11 @@ pub use rustc_hash::{FxHashMap, FxHashSet, FxHasher};
|
||||||
|
|
||||||
pub type FxIndexMap<K, V> = indexmap::IndexMap<K, V, BuildHasherDefault<FxHasher>>;
|
pub type FxIndexMap<K, V> = indexmap::IndexMap<K, V, BuildHasherDefault<FxHasher>>;
|
||||||
pub type FxIndexSet<V> = indexmap::IndexSet<V, BuildHasherDefault<FxHasher>>;
|
pub type FxIndexSet<V> = indexmap::IndexSet<V, BuildHasherDefault<FxHasher>>;
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! define_id_collections {
|
||||||
|
($map_name:ident, $set_name:ident, $key:ty) => {
|
||||||
|
pub type $map_name<T> = $crate::fx::FxHashMap<$key, T>;
|
||||||
|
pub type $set_name = $crate::fx::FxHashSet<$key>;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue