File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -520,7 +520,10 @@ pub trait BuildHasher {
520520 /// );
521521 /// ```
522522 #[ unstable( feature = "build_hasher_simple_hash_one" , issue = "86161" ) ]
523- fn hash_one < T : Hash > ( & self , x : T ) -> u64 {
523+ fn hash_one < T : Hash > ( & self , x : T ) -> u64
524+ where
525+ Self : Sized ,
526+ {
524527 let mut hasher = self . build_hasher ( ) ;
525528 x. hash ( & mut hasher) ;
526529 hasher. finish ( )
Original file line number Diff line number Diff line change 11mod sip;
22
33use std:: default:: Default ;
4- use std:: hash:: { Hash , Hasher } ;
4+ use std:: hash:: { BuildHasher , Hash , Hasher } ;
55use std:: rc:: Rc ;
66
77struct MyHasher {
@@ -139,3 +139,10 @@ fn test_indirect_hasher() {
139139 }
140140 assert_eq ! ( hasher. hash, 5 ) ;
141141}
142+
143+ #[ test]
144+ fn test_build_hasher_object_safe ( ) {
145+ use std:: collections:: hash_map:: { DefaultHasher , RandomState } ;
146+
147+ let _: & dyn BuildHasher < Hasher = DefaultHasher > = & RandomState :: new ( ) ;
148+ }
You can’t perform that action at this time.
0 commit comments