Skip to content

Commit b7ec415

Browse files
committed
wip
1 parent 3a6d75b commit b7ec415

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

compiler/rustc_data_structures/src/fx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::hash::BuildHasherDefault;
22

3-
pub use rustc_hash::{FxHashMap, FxHashSet, FxHasher};
3+
pub use rustc_hash::{FxHashMap, FxHashSet, FxHasher, FxBuildHasher};
44

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

compiler/rustc_mir_dataflow/src/impls/initialized2.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use rustc_data_structures::fx::FxIndexMap;
1+
use rustc_data_structures::fx::{FxBuildHasher, FxHashMap};
22
use rustc_index::Idx;
33
use rustc_index::bit_set::MixedBitSet;
44
use rustc_middle::mir::{
@@ -111,7 +111,7 @@ impl MovePathIndexMapper for DefaultMovePathIndexMapper {
111111
/// of interest.
112112
pub struct FilteringMovePathIndexMapper {
113113
/// Map of dense move paths to their associated sparse index.
114-
sparse_map: FxIndexMap<MovePathIndex, SparseMovePathIndex>,
114+
sparse_map: FxHashMap<MovePathIndex, SparseMovePathIndex>,
115115
}
116116

117117
impl MovePathIndexMapper for FilteringMovePathIndexMapper {
@@ -133,7 +133,8 @@ impl<'a, 'tcx> MaybeInitializedPlaces2<'a, 'tcx, DefaultMovePathIndexMapper> {
133133
self,
134134
interesting_move_paths: &[MovePathIndex],
135135
) -> MaybeInitializedPlaces2<'a, 'tcx, FilteringMovePathIndexMapper> {
136-
let mut sparse_map = FxIndexMap::default();
136+
let mut sparse_map =
137+
FxHashMap::with_capacity_and_hasher(interesting_move_paths.len(), FxBuildHasher);
137138
for (idx, &dense_idx) in interesting_move_paths.iter().enumerate() {
138139
let sparse_idx = SparseMovePathIndex::from_u32(idx.try_into().unwrap());
139140
sparse_map.insert(dense_idx, sparse_idx);

0 commit comments

Comments
 (0)