Skip to content

Commit

Permalink
Disallow blocking_{send,recv} on wasm32
Browse files Browse the repository at this point in the history
These current don't work on wasm32 and will panic in runtime

#5548
  • Loading branch information
frewsxcv authored Nov 19, 2023
1 parent 340d4e5 commit b46395f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tokio/src/sync/mpsc/bounded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ impl<T> Receiver<T> {
/// }
/// ```
#[track_caller]
#[cfg(feature = "sync")]
#[cfg(all(feature = "sync"), not(target_arch = "wasm32"))]
#[cfg_attr(docsrs, doc(alias = "recv_blocking"))]
pub fn blocking_recv(&mut self) -> Option<T> {
crate::future::block_on(self.recv())
Expand Down Expand Up @@ -777,6 +777,7 @@ impl<T> Sender<T> {
/// ```
#[track_caller]
#[cfg(feature = "sync")]
#[cfg(all(feature = "sync"), not(target_arch = "wasm32"))]
#[cfg_attr(docsrs, doc(alias = "send_blocking"))]
pub fn blocking_send(&self, value: T) -> Result<(), SendError<T>> {
crate::future::block_on(self.send(value))
Expand Down

0 comments on commit b46395f

Please sign in to comment.