Skip to content

Commit fb292b7

Browse files
committed
Auto merge of #150353 - llogiq:rustc-hash-refactor, r=eholk
refactor rustc-hash integration I found that rustc-hash is used in multiple compiler crates. Also some types use `FxBuildHasher` whereas others use `BuildHasherDefault<FxHasher>` (both do the same thing). In order to simplify future hashing experiments, I changed every location to use `rustc_data_structures::fx::*` types instead, and also removed the `BuildHasherDefault` variant. This will simplify future experiments with hashing (for example trying out a hasher that doesn't implement `Default` for whatever reason).
2 parents 873d468 + 8c69712 commit fb292b7

3 files changed

Lines changed: 6 additions & 10 deletions

File tree

compiler/rustc_data_structures/src/fx.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
use std::hash::BuildHasherDefault;
2-
31
pub use rustc_hash::{FxBuildHasher, FxHashMap, FxHashSet, FxHasher};
42

53
pub type StdEntry<'a, K, V> = std::collections::hash_map::Entry<'a, K, V>;
64

7-
pub type FxIndexMap<K, V> = indexmap::IndexMap<K, V, BuildHasherDefault<FxHasher>>;
8-
pub type FxIndexSet<V> = indexmap::IndexSet<V, BuildHasherDefault<FxHasher>>;
5+
pub type FxIndexMap<K, V> = indexmap::IndexMap<K, V, FxBuildHasher>;
6+
pub type FxIndexSet<V> = indexmap::IndexSet<V, FxBuildHasher>;
97
pub type IndexEntry<'a, K, V> = indexmap::map::Entry<'a, K, V>;
108
pub type IndexOccupiedEntry<'a, K, V> = indexmap::map::OccupiedEntry<'a, K, V>;
119

compiler/rustc_data_structures/src/unord.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ use std::hash::Hash;
88
use std::iter::{Product, Sum};
99
use std::ops::Index;
1010

11-
use rustc_hash::{FxBuildHasher, FxHashMap, FxHashSet};
1211
use rustc_macros::{Decodable_NoContext, Encodable_NoContext};
1312

1413
use crate::fingerprint::Fingerprint;
14+
use crate::fx::{FxBuildHasher, FxHashMap, FxHashSet};
1515
use crate::stable_hasher::{HashStable, StableCompare, StableHasher, ToStableHashKey};
1616

1717
/// `UnordItems` is the order-less version of `Iterator`. It only contains methods

compiler/rustc_type_ir/src/data_structures/mod.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
use std::hash::BuildHasherDefault;
2-
31
pub use ena::unify::{NoError, UnifyKey, UnifyValue};
4-
use rustc_hash::FxHasher;
2+
use rustc_hash::FxBuildHasher;
53
pub use rustc_hash::{FxHashMap as HashMap, FxHashSet as HashSet};
64

7-
pub type IndexMap<K, V> = indexmap::IndexMap<K, V, BuildHasherDefault<FxHasher>>;
8-
pub type IndexSet<V> = indexmap::IndexSet<V, BuildHasherDefault<FxHasher>>;
5+
pub type IndexMap<K, V> = indexmap::IndexMap<K, V, FxBuildHasher>;
6+
pub type IndexSet<V> = indexmap::IndexSet<V, FxBuildHasher>;
97

108
mod delayed_map;
119

0 commit comments

Comments
 (0)