From babee7f32a4919957836a002e2c971aac368bfab Mon Sep 17 00:00:00 2001 From: huntc Date: Wed, 14 Jul 2021 13:39:23 +1000 Subject: [PATCH] Tighten sender/receiver bounds --- embassy/src/util/mpsc.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/embassy/src/util/mpsc.rs b/embassy/src/util/mpsc.rs index 7f37eece..b30e4131 100644 --- a/embassy/src/util/mpsc.rs +++ b/embassy/src/util/mpsc.rs @@ -65,8 +65,10 @@ where } // Safe to pass the sender around -unsafe impl<'ch, M, T, const N: usize> Send for Sender<'ch, M, T, N> where M: Mutex {} -unsafe impl<'ch, M, T, const N: usize> Sync for Sender<'ch, M, T, N> where M: Mutex {} +unsafe impl<'ch, M, T, const N: usize> Send for Sender<'ch, M, T, N> where M: Mutex + Sync +{} +unsafe impl<'ch, M, T, const N: usize> Sync for Sender<'ch, M, T, N> where M: Mutex + Sync +{} /// Receive values from the associated `Sender`. /// @@ -79,8 +81,14 @@ where } // Safe to pass the receiver around -unsafe impl<'ch, M, T, const N: usize> Send for Receiver<'ch, M, T, N> where M: Mutex {} -unsafe impl<'ch, M, T, const N: usize> Sync for Receiver<'ch, M, T, N> where M: Mutex {} +unsafe impl<'ch, M, T, const N: usize> Send for Receiver<'ch, M, T, N> where + M: Mutex + Sync +{ +} +unsafe impl<'ch, M, T, const N: usize> Sync for Receiver<'ch, M, T, N> where + M: Mutex + Sync +{ +} /// Splits a bounded mpsc channel into a `Sender` and `Receiver`. ///