11use std:: borrow:: Borrow ;
2+ use std:: collections:: hash_map:: RawEntryMut ;
23use std:: hash:: { Hash , Hasher } ;
34use std:: { iter, mem} ;
45
56#[ cfg( parallel_compiler) ]
67use either:: Either ;
7- use indexmap:: map:: RawEntryApiV1 ;
8- use indexmap:: map:: raw_entry_v1:: RawEntryMut ;
98
10- use crate :: fx:: { FxHasher , FxIndexMap } ;
9+ use crate :: fx:: { FxHashMap , FxHasher } ;
1110#[ cfg( parallel_compiler) ]
1211use crate :: sync:: { CacheAligned , is_dyn_thread_safe} ;
1312use crate :: sync:: { Lock , LockGuard , Mode } ;
@@ -160,15 +159,15 @@ pub fn shards() -> usize {
160159 1
161160}
162161
163- pub type ShardedIndexMap < K , V > = Sharded < FxIndexMap < K , V > > ;
162+ pub type ShardedHashMap < K , V > = Sharded < FxHashMap < K , V > > ;
164163
165- impl < K : Eq , V > ShardedIndexMap < K , V > {
164+ impl < K : Eq , V > ShardedHashMap < K , V > {
166165 pub fn len ( & self ) -> usize {
167166 self . lock_shards ( ) . map ( |shard| shard. len ( ) ) . sum ( )
168167 }
169168}
170169
171- impl < K : Eq + Hash + Copy > ShardedIndexMap < K , ( ) > {
170+ impl < K : Eq + Hash + Copy > ShardedHashMap < K , ( ) > {
172171 #[ inline]
173172 pub fn intern_ref < Q : ?Sized > ( & self , value : & Q , make : impl FnOnce ( ) -> K ) -> K
174173 where
@@ -177,7 +176,7 @@ impl<K: Eq + Hash + Copy> ShardedIndexMap<K, ()> {
177176 {
178177 let hash = make_hash ( value) ;
179178 let mut shard = self . lock_shard_by_hash ( hash) ;
180- let entry = shard. raw_entry_mut_v1 ( ) . from_key_hashed_nocheck ( hash, value) ;
179+ let entry = shard. raw_entry_mut ( ) . from_key_hashed_nocheck ( hash, value) ;
181180
182181 match entry {
183182 RawEntryMut :: Occupied ( e) => * e. key ( ) ,
@@ -197,7 +196,7 @@ impl<K: Eq + Hash + Copy> ShardedIndexMap<K, ()> {
197196 {
198197 let hash = make_hash ( & value) ;
199198 let mut shard = self . lock_shard_by_hash ( hash) ;
200- let entry = shard. raw_entry_mut_v1 ( ) . from_key_hashed_nocheck ( hash, & value) ;
199+ let entry = shard. raw_entry_mut ( ) . from_key_hashed_nocheck ( hash, & value) ;
201200
202201 match entry {
203202 RawEntryMut :: Occupied ( e) => * e. key ( ) ,
@@ -215,12 +214,12 @@ pub trait IntoPointer {
215214 fn into_pointer ( & self ) -> * const ( ) ;
216215}
217216
218- impl < K : Eq + Hash + Copy + IntoPointer > ShardedIndexMap < K , ( ) > {
217+ impl < K : Eq + Hash + Copy + IntoPointer > ShardedHashMap < K , ( ) > {
219218 pub fn contains_pointer_to < T : Hash + IntoPointer > ( & self , value : & T ) -> bool {
220219 let hash = make_hash ( & value) ;
221220 let shard = self . lock_shard_by_hash ( hash) ;
222221 let value = value. into_pointer ( ) ;
223- shard. raw_entry_v1 ( ) . from_hash ( hash, |entry| entry. into_pointer ( ) == value) . is_some ( )
222+ shard. raw_entry ( ) . from_hash ( hash, |entry| entry. into_pointer ( ) == value) . is_some ( )
224223 }
225224}
226225
0 commit comments