about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorPietro Albini <pietro@pietroalbini.org>2019-03-08 09:41:42 +0100
committerGitHub <noreply@github.com>2019-03-08 09:41:42 +0100
commit55dc386f6188a68f4be5e49f5e8001a6302981fa (patch)
tree1694084d8337874eb95c5933a782c5697c9dc874 /src/libstd
parentbf7b50254ee7b9fb61c000420084d7929adba66d (diff)
parent1fec8c28353321048447465506dc68ab3a6c335e (diff)
downloadrust-55dc386f6188a68f4be5e49f5e8001a6302981fa.tar.gz
rust-55dc386f6188a68f4be5e49f5e8001a6302981fa.zip
Rollup merge of #58369 - nox:sync-hash-map-entry, r=Amanieu
Make the Entry API of HashMap<K, V> Sync and Send

Fixes #45219
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/collections/hash/map.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs
index a51847c92b5..928de29b297 100644
--- a/src/libstd/collections/hash/map.rs
+++ b/src/libstd/collections/hash/map.rs
@@ -2341,6 +2341,11 @@ pub struct OccupiedEntry<'a, K: 'a, V: 'a> {
     elem: FullBucket<K, V, &'a mut RawTable<K, V>>,
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
+unsafe impl<'a, K: 'a + Send, V: 'a + Send> Send for OccupiedEntry<'a, K, V> {}
+#[stable(feature = "rust1", since = "1.0.0")]
+unsafe impl<'a, K: 'a + Sync, V: 'a + Sync> Sync for OccupiedEntry<'a, K, V> {}
+
 #[stable(feature= "debug_hash_map", since = "1.12.0")]
 impl<K: Debug, V: Debug> Debug for OccupiedEntry<'_, K, V> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
@@ -2362,6 +2367,11 @@ pub struct VacantEntry<'a, K: 'a, V: 'a> {
     elem: VacantEntryState<K, V, &'a mut RawTable<K, V>>,
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
+unsafe impl<'a, K: 'a + Send, V: 'a + Send> Send for VacantEntry<'a, K, V> {}
+#[stable(feature = "rust1", since = "1.0.0")]
+unsafe impl<'a, K: 'a + Sync, V: 'a + Sync> Sync for VacantEntry<'a, K, V> {}
+
 #[stable(feature= "debug_hash_map", since = "1.12.0")]
 impl<K: Debug, V> Debug for VacantEntry<'_, K, V> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {