@@ -23,6 +23,7 @@ use super::raw::bitmask::BitMask;
23
23
use super :: raw:: imp:: Group ;
24
24
use super :: scopeguard:: guard;
25
25
use super :: util:: { cold_path, make_insert_hash} ;
26
+ use crate :: sync:: { DynSend , DynSync } ;
26
27
27
28
mod code;
28
29
mod tests;
@@ -627,7 +628,10 @@ struct DestroyTable<T> {
627
628
}
628
629
629
630
unsafe impl < T > Sync for DestroyTable < T > { }
630
- unsafe impl < T : Send > Send for DestroyTable < T > { }
631
+
632
+ // FIXME: Unsound
633
+ //unsafe impl<T: Send> Send for DestroyTable<T> {}
634
+ unsafe impl < T : DynSend > Send for DestroyTable < T > { }
631
635
632
636
impl < T > DestroyTable < T > {
633
637
unsafe fn run ( & self ) {
@@ -653,8 +657,9 @@ unsafe impl<#[may_dangle] K, #[may_dangle] V, S> Drop for SyncTable<K, V, S> {
653
657
}
654
658
}
655
659
656
- unsafe impl < K : Send , V : Send , S : Send > Send for SyncTable < K , V , S > { }
660
+ unsafe impl < K : DynSend , V : DynSend , S : DynSend > DynSend for SyncTable < K , V , S > { }
657
661
unsafe impl < K : Sync , V : Sync , S : Sync > Sync for SyncTable < K , V , S > { }
662
+ unsafe impl < K : DynSync , V : DynSync , S : DynSync > DynSync for SyncTable < K , V , S > { }
658
663
659
664
impl < K , V , S : Default > Default for SyncTable < K , V , S > {
660
665
#[ inline]
@@ -944,7 +949,7 @@ impl<'a, K, V, S> Write<'a, K, V, S> {
944
949
}
945
950
}
946
951
947
- impl < ' a , K : Send , V : Send + Clone , S : BuildHasher > Write < ' a , K , V , S > {
952
+ impl < ' a , K : DynSend , V : DynSend + Clone , S : BuildHasher > Write < ' a , K , V , S > {
948
953
/// Removes an element from the table, and returns a reference to it if was present.
949
954
#[ inline]
950
955
pub fn remove < Q > ( & mut self , key : & Q , hash : Option < u64 > ) -> Option < ( & ' a K , & ' a V ) >
@@ -970,7 +975,7 @@ impl<'a, K: Send, V: Send + Clone, S: BuildHasher> Write<'a, K, V, S> {
970
975
}
971
976
}
972
977
973
- impl < ' a , K : Hash + Eq + Send + Clone , V : Send + Clone , S : BuildHasher > Write < ' a , K , V , S > {
978
+ impl < ' a , K : Hash + Eq + DynSend + Clone , V : DynSend + Clone , S : BuildHasher > Write < ' a , K , V , S > {
974
979
/// Inserts a element into the table.
975
980
/// Returns `false` if it already exists and doesn't update the value.
976
981
#[ inline]
@@ -995,7 +1000,7 @@ impl<'a, K: Hash + Eq + Send + Clone, V: Send + Clone, S: BuildHasher> Write<'a,
995
1000
}
996
1001
}
997
1002
998
- impl < ' a , K : Hash + Send + Clone , V : Send + Clone , S : BuildHasher > Write < ' a , K , V , S > {
1003
+ impl < ' a , K : Hash + DynSend + Clone , V : DynSend + Clone , S : BuildHasher > Write < ' a , K , V , S > {
999
1004
/// Inserts a new element into the table, and returns a reference to it.
1000
1005
///
1001
1006
/// This does not check if the given element already exists in the table.
@@ -1065,7 +1070,7 @@ impl<'a, K: Hash + Send + Clone, V: Send + Clone, S: BuildHasher> Write<'a, K, V
1065
1070
}
1066
1071
}
1067
1072
1068
- impl < K : Hash + Send , V : Send , S : BuildHasher > Write < ' _ , K , V , S > {
1073
+ impl < K : Hash + DynSend , V : DynSend , S : BuildHasher > Write < ' _ , K , V , S > {
1069
1074
fn replace_table ( & mut self , new_table : TableRef < ( K , V ) > ) {
1070
1075
let table = self . table . current ( ) ;
1071
1076
@@ -1111,8 +1116,8 @@ impl<K: Hash + Send, V: Send, S: BuildHasher> Write<'_, K, V, S> {
1111
1116
}
1112
1117
}
1113
1118
1114
- impl < K : Eq + Hash + Clone + Send , V : Clone + Send , S : BuildHasher + Default > FromIterator < ( K , V ) >
1115
- for SyncTable < K , V , S >
1119
+ impl < K : Eq + Hash + Clone + DynSend , V : Clone + DynSend , S : BuildHasher + Default >
1120
+ FromIterator < ( K , V ) > for SyncTable < K , V , S >
1116
1121
{
1117
1122
fn from_iter < I : IntoIterator < Item = ( K , V ) > > ( iter : I ) -> Self {
1118
1123
let iter = iter. into_iter ( ) ;
@@ -1221,7 +1226,7 @@ impl<'a> PotentialSlot<'a> {
1221
1226
///
1222
1227
/// This does not check if the given element already exists in the table.
1223
1228
#[ inline]
1224
- pub fn insert_new < ' b , K : Hash + Send + Clone , V : Send + Clone , S : BuildHasher > (
1229
+ pub fn insert_new < ' b , K : Hash + DynSend + Clone , V : DynSend + Clone , S : BuildHasher > (
1225
1230
self ,
1226
1231
table : & mut Write < ' b , K , V , S > ,
1227
1232
key : K ,
@@ -1485,9 +1490,9 @@ impl<T> RawIterRange<T> {
1485
1490
}
1486
1491
}
1487
1492
1488
- // We make raw iterators unconditionally Send and Sync, and let the PhantomData
1489
- // in the actual iterator implementations determine the real Send /Sync bounds.
1490
- unsafe impl < T > Send for RawIterRange < T > { }
1493
+ // We make raw iterators unconditionally DynSend and Sync, and let the PhantomData
1494
+ // in the actual iterator implementations determine the real DynSend /Sync bounds.
1495
+ unsafe impl < T > DynSend for RawIterRange < T > { }
1491
1496
unsafe impl < T > Sync for RawIterRange < T > { }
1492
1497
1493
1498
impl < T > Clone for RawIterRange < T > {
0 commit comments