From 27cd1932759f2df9c4f30781181499b824eab109 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Wed, 2 Jun 2021 10:39:14 +0200 Subject: [PATCH 1/2] sync: deprecate RecvError --- tokio/src/sync/mpsc/bounded.rs | 4 ++-- tokio/src/sync/mpsc/error.rs | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tokio/src/sync/mpsc/bounded.rs b/tokio/src/sync/mpsc/bounded.rs index 74e6b745f9c..cfd8da03db6 100644 --- a/tokio/src/sync/mpsc/bounded.rs +++ b/tokio/src/sync/mpsc/bounded.rs @@ -65,7 +65,7 @@ pub struct Receiver { /// with backpressure. /// /// The channel will buffer up to the provided number of messages. Once the -/// buffer is full, attempts to `send` new messages will wait until a message is +/// buffer is full, attempts to send new messages will wait until a message is /// received from the channel. The provided buffer capacity must be at least 1. /// /// All data sent on `Sender` will become available on `Receiver` in the same @@ -76,7 +76,7 @@ pub struct Receiver { /// /// If the `Receiver` is disconnected while trying to `send`, the `send` method /// will return a `SendError`. Similarly, if `Sender` is disconnected while -/// trying to `recv`, the `recv` method will return a `RecvError`. +/// trying to `recv`, the `recv` method will return `None`. /// /// # Panics /// diff --git a/tokio/src/sync/mpsc/error.rs b/tokio/src/sync/mpsc/error.rs index a2d28240dae..0d25ad3869b 100644 --- a/tokio/src/sync/mpsc/error.rs +++ b/tokio/src/sync/mpsc/error.rs @@ -55,14 +55,18 @@ impl From> for TrySendError { /// Error returned by `Receiver`. #[derive(Debug)] +#[doc(hidden)] +#[deprecated(note = "This type is unused because recv returns an Option.")] pub struct RecvError(()); +#[allow(deprecated)] impl fmt::Display for RecvError { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { write!(fmt, "channel closed") } } +#[allow(deprecated)] impl Error for RecvError {} cfg_time! { From 1e95b2dacb18de5bd51ce6eae7bc5a8d1e0e9876 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Fri, 11 Jun 2021 10:31:16 +0200 Subject: [PATCH 2/2] poke ci