about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-01-27 17:50:34 +0000
committerbors <bors@rust-lang.org>2025-01-27 17:50:34 +0000
commitebcf860e7345e3387b4c6961338c77424b43cbd5 (patch)
treefb281de257d7239f019459cce70a2f2aba633fb3 /library/std/src
parent0cffe5cb95e36d45a3e61f7b1f5a9b21eddd77b4 (diff)
parent3d02ce7d6b3aa3868b5f6ebc794b8e73fb45b202 (diff)
downloadrust-ebcf860e7345e3387b4c6961338c77424b43cbd5.tar.gz
rust-ebcf860e7345e3387b4c6961338c77424b43cbd5.zip
Auto merge of #136135 - GuillaumeGomez:rollup-1ik636d, r=GuillaumeGomez
Rollup of 10 pull requests

Successful merges:

 - #135773 (Clarify WindowsMut (Lending)Iterator)
 - #135807 (Implement phantom variance markers)
 - #135876 (fix doc for std::sync::mpmc)
 - #135988 (Add a workaround for parallel rustc crashing when there are delayed bugs)
 - #136037 (Mark all NuttX targets as tier 3 target and support the standard library)
 - #136064 (Add a suggestion to cast target_feature fn items to fn pointers.)
 - #136082 (Incorporate `iter_nodes` into `graph::DirectedGraph`)
 - #136112 (Clean up all dead files inside `tests/ui/`)
 - #136114 (Use identifiers more in diagnostics code)
 - #136118 (Change `collect_and_partition_mono_items` tuple return type to a struct)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/sync/mpmc/mod.rs16
1 files changed, 12 insertions, 4 deletions
diff --git a/library/std/src/sync/mpmc/mod.rs b/library/std/src/sync/mpmc/mod.rs
index 0cf4902d6d5..00966ee3ecf 100644
--- a/library/std/src/sync/mpmc/mod.rs
+++ b/library/std/src/sync/mpmc/mod.rs
@@ -18,7 +18,7 @@
 //!    infinite buffer.
 //!
 //! 2. A synchronous, bounded channel. The [`sync_channel`] function will
-//!    return a `(SyncSender, Receiver)` tuple where the storage for pending
+//!    return a `(Sender, Receiver)` tuple where the storage for pending
 //!    messages is a pre-allocated buffer of a fixed size. All sends will be
 //!    **synchronous** by blocking until there is buffer space available. Note
 //!    that a bound of 0 is allowed, causing the channel to become a "rendezvous"
@@ -360,9 +360,17 @@ impl<T> Sender<T> {
     /// that a return value of [`Err`] means that the data will never be
     /// received, but a return value of [`Ok`] does *not* mean that the data
     /// will be received. It is possible for the corresponding receiver to
-    /// hang up immediately after this function returns [`Ok`].
+    /// hang up immediately after this function returns [`Ok`]. However, if
+    /// the channel is zero-capacity, it acts as a rendezvous channel and a
+    /// return value of [`Ok`] means that the data has been received.
     ///
-    /// This method will never block the current thread.
+    /// If the channel is full and not disconnected, this call will block until
+    /// the send operation can proceed. If the channel becomes disconnected,
+    /// this call will wake up and return an error. The returned error contains
+    /// the original message.
+    ///
+    /// If called on a zero-capacity channel, this method will wait for a receive
+    /// operation to appear on the other side of the channel.
     ///
     /// # Examples
     ///
@@ -650,7 +658,7 @@ impl<T> fmt::Debug for Sender<T> {
 }
 
 /// The receiving half of Rust's [`channel`] (or [`sync_channel`]) type.
-/// Different threads can share this [`Sender`] by cloning it.
+/// Different threads can share this [`Receiver`] by cloning it.
 ///
 /// Messages sent to the channel can be retrieved using [`recv`].
 ///