@@ -242,6 +242,7 @@ where
242
242
move |x| k. eq ( x. borrow ( ) )
243
243
}
244
244
245
+ #[ cfg( not( feature = "nightly" ) ) ]
245
246
#[ cfg_attr( feature = "inline-more" , inline) ]
246
247
pub ( crate ) fn make_hash < K , Q , S > ( hash_builder : & S , val : & Q ) -> u64
247
248
where
@@ -255,6 +256,18 @@ where
255
256
state. finish ( )
256
257
}
257
258
259
+ #[ cfg( feature = "nightly" ) ]
260
+ #[ cfg_attr( feature = "inline-more" , inline) ]
261
+ pub ( crate ) fn make_hash < K , Q , S > ( hash_builder : & S , val : & Q ) -> u64
262
+ where
263
+ K : Borrow < Q > ,
264
+ Q : Hash + ?Sized ,
265
+ S : BuildHasher ,
266
+ {
267
+ hash_builder. hash_one ( val)
268
+ }
269
+
270
+ #[ cfg( not( feature = "nightly" ) ) ]
258
271
#[ cfg_attr( feature = "inline-more" , inline) ]
259
272
pub ( crate ) fn make_insert_hash < K , S > ( hash_builder : & S , val : & K ) -> u64
260
273
where
@@ -267,6 +280,16 @@ where
267
280
state. finish ( )
268
281
}
269
282
283
+ #[ cfg( feature = "nightly" ) ]
284
+ #[ cfg_attr( feature = "inline-more" , inline) ]
285
+ pub ( crate ) fn make_insert_hash < K , S > ( hash_builder : & S , val : & K ) -> u64
286
+ where
287
+ K : Hash ,
288
+ S : BuildHasher ,
289
+ {
290
+ hash_builder. hash_one ( val)
291
+ }
292
+
270
293
#[ cfg( feature = "ahash" ) ]
271
294
impl < K , V > HashMap < K , V , DefaultHashBuilder > {
272
295
/// Creates an empty `HashMap`.
@@ -4793,8 +4816,6 @@ mod test_map {
4793
4816
#[ test]
4794
4817
#[ cfg( feature = "raw" ) ]
4795
4818
fn test_into_iter_refresh ( ) {
4796
- use core:: hash:: { BuildHasher , Hash , Hasher } ;
4797
-
4798
4819
#[ cfg( miri) ]
4799
4820
const N : usize = 32 ;
4800
4821
#[ cfg( not( miri) ) ]
@@ -4817,9 +4838,7 @@ mod test_map {
4817
4838
loop {
4818
4839
// occasionally remove some elements
4819
4840
if i < n && rng. gen_bool ( 0.1 ) {
4820
- let mut hasher = hash_builder. build_hasher ( ) ;
4821
- i. hash ( & mut hasher) ;
4822
- let hash_value = hasher. finish ( ) ;
4841
+ let hash_value = super :: make_insert_hash ( & hash_builder, & i) ;
4823
4842
4824
4843
unsafe {
4825
4844
let e = map. table . find ( hash_value, |q| q. 0 . eq ( & i) ) ;
0 commit comments