11
11
use borrow:: Borrow ;
12
12
use clone:: Clone ;
13
13
use cmp:: { Eq , PartialEq } ;
14
- use core:: marker:: Sized ;
14
+ use core:: marker:: { Sized , Send , Sync } ;
15
15
use default:: Default ;
16
16
use fmt:: Debug ;
17
17
use fmt;
@@ -764,18 +764,27 @@ pub struct Iter<'a, K: 'a> {
764
764
iter : Keys < ' a , K , ( ) >
765
765
}
766
766
767
+ unsafe impl < ' a , K : Send > Send for Iter < ' a , K > { }
768
+ unsafe impl < ' a , K : Sync > Sync for Iter < ' a , K > { }
769
+
767
770
/// HashSet move iterator
768
771
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
769
772
pub struct IntoIter < K > {
770
773
iter : Map < map:: IntoIter < K , ( ) > , fn ( ( K , ( ) ) ) -> K >
771
774
}
772
775
776
+ unsafe impl < K : Send > Send for IntoIter < K > { }
777
+ unsafe impl < K : Sync > Sync for IntoIter < K > { }
778
+
773
779
/// HashSet drain iterator
774
780
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
775
781
pub struct Drain < ' a , K : ' a > {
776
782
iter : Map < map:: Drain < ' a , K , ( ) > , fn ( ( K , ( ) ) ) -> K > ,
777
783
}
778
784
785
+ unsafe impl < ' a , K : Send > Send for Drain < ' a , K > { }
786
+ unsafe impl < ' a , K : Sync > Sync for Drain < ' a , K > { }
787
+
779
788
/// Intersection iterator
780
789
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
781
790
pub struct Intersection < ' a , T : ' a , S : ' a > {
@@ -785,6 +794,9 @@ pub struct Intersection<'a, T: 'a, S: 'a> {
785
794
other : & ' a HashSet < T , S > ,
786
795
}
787
796
797
+ unsafe impl < ' a , K : Send , S : Send > Send for Intersection < ' a , K , S > { }
798
+ unsafe impl < ' a , K : Sync , S : Send > Sync for Intersection < ' a , K , S > { }
799
+
788
800
/// Difference iterator
789
801
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
790
802
pub struct Difference < ' a , T : ' a , S : ' a > {
@@ -794,18 +806,27 @@ pub struct Difference<'a, T: 'a, S: 'a> {
794
806
other : & ' a HashSet < T , S > ,
795
807
}
796
808
809
+ unsafe impl < ' a , K : Send , S : Send > Send for Difference < ' a , K , S > { }
810
+ unsafe impl < ' a , K : Sync , S : Send > Sync for Difference < ' a , K , S > { }
811
+
797
812
/// Symmetric difference iterator.
798
813
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
799
814
pub struct SymmetricDifference < ' a , T : ' a , S : ' a > {
800
815
iter : Chain < Difference < ' a , T , S > , Difference < ' a , T , S > >
801
816
}
802
817
818
+ unsafe impl < ' a , K : Send , S : Send > Send for SymmetricDifference < ' a , K , S > { }
819
+ unsafe impl < ' a , K : Sync , S : Send > Sync for SymmetricDifference < ' a , K , S > { }
820
+
803
821
/// Set union iterator.
804
822
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
805
823
pub struct Union < ' a , T : ' a , S : ' a > {
806
824
iter : Chain < Iter < ' a , T > , Difference < ' a , T , S > >
807
825
}
808
826
827
+ unsafe impl < ' a , K : Send , S : Send > Send for Union < ' a , K , S > { }
828
+ unsafe impl < ' a , K : Sync , S : Send > Sync for Union < ' a , K , S > { }
829
+
809
830
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
810
831
impl < ' a , T , S > IntoIterator for & ' a HashSet < T , S >
811
832
where T : Eq + Hash , S : HashState
0 commit comments