diff options
| author | huntc <[email protected]> | 2021-07-14 13:39:23 +1000 |
|---|---|---|
| committer | huntc <[email protected]> | 2021-07-15 12:31:53 +1000 |
| commit | babee7f32a4919957836a002e2c971aac368bfab (patch) | |
| tree | 0b484710bf441d2e2b0f04a077b0b99780ac6590 | |
| parent | d86892ca566907aa7b9c29971229262557be49dc (diff) | |
Tighten sender/receiver bounds
| -rw-r--r-- | embassy/src/util/mpsc.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/embassy/src/util/mpsc.rs b/embassy/src/util/mpsc.rs index 7f37eece4..b30e41318 100644 --- a/embassy/src/util/mpsc.rs +++ b/embassy/src/util/mpsc.rs | |||
| @@ -65,8 +65,10 @@ where | |||
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | // Safe to pass the sender around | 67 | // Safe to pass the sender around |
| 68 | unsafe impl<'ch, M, T, const N: usize> Send for Sender<'ch, M, T, N> where M: Mutex<Data = ()> {} | 68 | unsafe impl<'ch, M, T, const N: usize> Send for Sender<'ch, M, T, N> where M: Mutex<Data = ()> + Sync |
| 69 | unsafe impl<'ch, M, T, const N: usize> Sync for Sender<'ch, M, T, N> where M: Mutex<Data = ()> {} | 69 | {} |
| 70 | unsafe impl<'ch, M, T, const N: usize> Sync for Sender<'ch, M, T, N> where M: Mutex<Data = ()> + Sync | ||
| 71 | {} | ||
| 70 | 72 | ||
| 71 | /// Receive values from the associated `Sender`. | 73 | /// Receive values from the associated `Sender`. |
| 72 | /// | 74 | /// |
| @@ -79,8 +81,14 @@ where | |||
| 79 | } | 81 | } |
| 80 | 82 | ||
| 81 | // Safe to pass the receiver around | 83 | // Safe to pass the receiver around |
| 82 | unsafe impl<'ch, M, T, const N: usize> Send for Receiver<'ch, M, T, N> where M: Mutex<Data = ()> {} | 84 | unsafe impl<'ch, M, T, const N: usize> Send for Receiver<'ch, M, T, N> where |
| 83 | unsafe impl<'ch, M, T, const N: usize> Sync for Receiver<'ch, M, T, N> where M: Mutex<Data = ()> {} | 85 | M: Mutex<Data = ()> + Sync |
| 86 | { | ||
| 87 | } | ||
| 88 | unsafe impl<'ch, M, T, const N: usize> Sync for Receiver<'ch, M, T, N> where | ||
| 89 | M: Mutex<Data = ()> + Sync | ||
| 90 | { | ||
| 91 | } | ||
| 84 | 92 | ||
| 85 | /// Splits a bounded mpsc channel into a `Sender` and `Receiver`. | 93 | /// Splits a bounded mpsc channel into a `Sender` and `Receiver`. |
| 86 | /// | 94 | /// |
