From 4cae5d5068e64db47a9c695f588cf44648514b4c Mon Sep 17 00:00:00 2001 From: Amanieu d'Antras Date: Sun, 19 Dec 2021 01:20:29 +0100 Subject: [PATCH] Fix trait bounds on Send/Sync impls --- src/external_trait_impls/rayon/raw.rs | 4 +-- src/map.rs | 4 ++- src/raw/mod.rs | 42 +++++++++++++++++++++++---- 3 files changed, 41 insertions(+), 9 deletions(-) diff --git a/src/external_trait_impls/rayon/raw.rs b/src/external_trait_impls/rayon/raw.rs index 7724634c11..883303e278 100644 --- a/src/external_trait_impls/rayon/raw.rs +++ b/src/external_trait_impls/rayon/raw.rs @@ -87,7 +87,7 @@ impl RawIntoParIter { } } -impl ParallelIterator for RawIntoParIter { +impl ParallelIterator for RawIntoParIter { type Item = T; #[cfg_attr(feature = "inline-more", inline)] @@ -116,7 +116,7 @@ pub struct RawParDrain<'a, T, A: Allocator + Clone = Global> { marker: PhantomData<&'a RawTable>, } -unsafe impl Send for RawParDrain<'_, T, A> {} +unsafe impl Send for RawParDrain<'_, T, A> {} impl RawParDrain<'_, T, A> { #[cfg_attr(feature = "inline-more", inline)] diff --git a/src/map.rs b/src/map.rs index 5f5f8313af..b5c0cf82ea 100644 --- a/src/map.rs +++ b/src/map.rs @@ -2113,6 +2113,7 @@ unsafe impl Send for RawOccupiedEntryMut<'_, K, V, S, A> where K: Send, V: Send, + S: Send, A: Send + Allocator + Clone, { } @@ -2120,7 +2121,8 @@ unsafe impl Sync for RawOccupiedEntryMut<'_, K, V, S, A> where K: Sync, V: Sync, - A: Send + Allocator + Clone, + S: Sync, + A: Sync + Allocator + Clone, { } diff --git a/src/raw/mod.rs b/src/raw/mod.rs index e65c0b0bf0..fce54d9f0e 100644 --- a/src/raw/mod.rs +++ b/src/raw/mod.rs @@ -1031,8 +1031,18 @@ impl RawTable { } } -unsafe impl Send for RawTable where T: Send {} -unsafe impl Sync for RawTable where T: Sync {} +unsafe impl Send for RawTable +where + T: Send, + A: Send, +{ +} +unsafe impl Sync for RawTable +where + T: Sync, + A: Sync, +{ +} impl RawTableInner { #[inline] @@ -2156,8 +2166,18 @@ impl RawIntoIter { } } -unsafe impl Send for RawIntoIter where T: Send {} -unsafe impl Sync for RawIntoIter where T: Sync {} +unsafe impl Send for RawIntoIter +where + T: Send, + A: Send, +{ +} +unsafe impl Sync for RawIntoIter +where + T: Sync, + A: Sync, +{ +} #[cfg(feature = "nightly")] unsafe impl<#[may_dangle] T, A: Allocator + Clone> Drop for RawIntoIter { @@ -2229,8 +2249,18 @@ impl RawDrain<'_, T, A> { } } -unsafe impl Send for RawDrain<'_, T, A> where T: Send {} -unsafe impl Sync for RawDrain<'_, T, A> where T: Sync {} +unsafe impl Send for RawDrain<'_, T, A> +where + T: Send, + A: Send, +{ +} +unsafe impl Sync for RawDrain<'_, T, A> +where + T: Sync, + A: Sync, +{ +} impl Drop for RawDrain<'_, T, A> { #[cfg_attr(feature = "inline-more", inline)]