Skip to content

Use intra-doc-links in std::sync::* #75790

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 18 additions & 21 deletions library/std/src/sync/condvar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::time::{Duration, Instant};
///
/// It is returned by the [`wait_timeout`] method.
///
/// [`wait_timeout`]: struct.Condvar.html#method.wait_timeout
/// [`wait_timeout`]: Condvar::wait_timeout
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
#[stable(feature = "wait_timeout", since = "1.5.0")]
pub struct WaitTimeoutResult(bool);
Expand Down Expand Up @@ -161,11 +161,10 @@ impl Condvar {
/// mutex to ensure defined behavior across platforms. If this functionality
/// is not desired, then unsafe primitives in `sys` are provided.
///
/// [`notify_one`]: #method.notify_one
/// [`notify_all`]: #method.notify_all
/// [poisoning]: ../sync/struct.Mutex.html#poisoning
/// [`Mutex`]: ../sync/struct.Mutex.html
/// [`panic!`]: ../../std/macro.panic.html
/// [`notify_one`]: Self::notify_one
/// [`notify_all`]: Self::notify_all
/// [poisoning]: super::Mutex#poisoning
/// [`Mutex`]: super::Mutex
///
/// # Examples
///
Expand Down Expand Up @@ -218,10 +217,10 @@ impl Condvar {
/// poisoned when this thread re-acquires the lock. For more information,
/// see information about [poisoning] on the [`Mutex`] type.
///
/// [`notify_one`]: #method.notify_one
/// [`notify_all`]: #method.notify_all
/// [poisoning]: ../sync/struct.Mutex.html#poisoning
/// [`Mutex`]: ../sync/struct.Mutex.html
/// [`notify_one`]: Self::notify_one
/// [`notify_all`]: Self::notify_all
/// [poisoning]: super::Mutex#poisoning
/// [`Mutex`]: super::Mutex
///
/// # Examples
///
Expand Down Expand Up @@ -280,7 +279,7 @@ impl Condvar {
/// Like [`wait`], the lock specified will be re-acquired when this function
/// returns, regardless of whether the timeout elapsed or not.
///
/// [`wait`]: #method.wait
/// [`wait`]: Self::wait
///
/// # Examples
///
Expand Down Expand Up @@ -350,9 +349,8 @@ impl Condvar {
/// Like [`wait`], the lock specified will be re-acquired when this function
/// returns, regardless of whether the timeout elapsed or not.
///
/// [`wait`]: #method.wait
/// [`wait_timeout_while`]: #method.wait_timeout_while
/// [`WaitTimeoutResult`]: struct.WaitTimeoutResult.html
/// [`wait`]: Self::wait
/// [`wait_timeout_while`]: Self::wait_timeout_while
///
/// # Examples
///
Expand Down Expand Up @@ -420,9 +418,8 @@ impl Condvar {
/// Like [`wait_while`], the lock specified will be re-acquired when this
/// function returns, regardless of whether the timeout elapsed or not.
///
/// [`wait_while`]: #method.wait_while
/// [`wait_timeout`]: #method.wait_timeout
/// [`WaitTimeoutResult`]: struct.WaitTimeoutResult.html
/// [`wait_while`]: Self::wait_while
/// [`wait_timeout`]: Self::wait_timeout
///
/// # Examples
///
Expand Down Expand Up @@ -485,9 +482,9 @@ impl Condvar {
///
/// To wake up all threads, see [`notify_all`].
///
/// [`wait`]: #method.wait
/// [`wait_timeout`]: #method.wait_timeout
/// [`notify_all`]: #method.notify_all
/// [`wait`]: Self::wait
/// [`wait_timeout`]: Self::wait_timeout
/// [`notify_all`]: Self::notify_all
///
/// # Examples
///
Expand Down Expand Up @@ -527,7 +524,7 @@ impl Condvar {
///
/// To wake up only one thread, see [`notify_one`].
///
/// [`notify_one`]: #method.notify_one
/// [`notify_one`]: Self::notify_one
///
/// # Examples
///
Expand Down
108 changes: 22 additions & 86 deletions library/std/src/sync/mpsc/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore-tidy-filelength

//! Multi-producer, single-consumer FIFO queue communication primitives.
//!
//! This module provides message-based communication over channels, concretely
Expand Down Expand Up @@ -27,12 +25,7 @@
//! that a bound of 0 is allowed, causing the channel to become a "rendezvous"
//! channel where each sender atomically hands off a message to a receiver.
//!
//! [`Sender`]: ../../../std/sync/mpsc/struct.Sender.html
//! [`SyncSender`]: ../../../std/sync/mpsc/struct.SyncSender.html
//! [`Receiver`]: ../../../std/sync/mpsc/struct.Receiver.html
//! [`send`]: ../../../std/sync/mpsc/struct.Sender.html#method.send
//! [`channel`]: ../../../std/sync/mpsc/fn.channel.html
//! [`sync_channel`]: ../../../std/sync/mpsc/fn.sync_channel.html
//! [`send`]: Sender::send
//!
//! ## Disconnection
//!
Expand All @@ -46,9 +39,7 @@
//! will continue to [`unwrap`] the results returned from this module,
//! instigating a propagation of failure among threads if one unexpectedly dies.
//!
//! [`Result`]: ../../../std/result/enum.Result.html
//! [`Err`]: ../../../std/result/enum.Result.html#variant.Err
//! [`unwrap`]: ../../../std/result/enum.Result.html#method.unwrap
//! [`unwrap`]: Result::unwrap
//!
//! # Examples
//!
Expand Down Expand Up @@ -291,9 +282,7 @@ mod cache_aligned;
///
/// Messages sent to the channel can be retrieved using [`recv`].
///
/// [`channel`]: fn.channel.html
/// [`sync_channel`]: fn.sync_channel.html
/// [`recv`]: struct.Receiver.html#method.recv
/// [`recv`]: Receiver::recv
///
/// # Examples
///
Expand Down Expand Up @@ -333,10 +322,8 @@ impl<T> !Sync for Receiver<T> {}
/// waiting for a new message, and [`None`] will be returned
/// when the corresponding channel has hung up.
///
/// [`iter`]: struct.Receiver.html#method.iter
/// [`Receiver`]: struct.Receiver.html
/// [`next`]: ../../../std/iter/trait.Iterator.html#tymethod.next
/// [`None`]: ../../../std/option/enum.Option.html#variant.None
/// [`iter`]: Receiver::iter
/// [`next`]: Iterator::next
///
/// # Examples
///
Expand Down Expand Up @@ -371,9 +358,7 @@ pub struct Iter<'a, T: 'a> {
/// This iterator will never block the caller in order to wait for data to
/// become available. Instead, it will return [`None`].
///
/// [`Receiver`]: struct.Receiver.html
/// [`try_iter`]: struct.Receiver.html#method.try_iter
/// [`None`]: ../../../std/option/enum.Option.html#variant.None
/// [`try_iter`]: Receiver::try_iter
///
/// # Examples
///
Expand Down Expand Up @@ -414,9 +399,7 @@ pub struct TryIter<'a, T: 'a> {
/// is called, waiting for a new message, and [`None`] will be
/// returned if the corresponding channel has hung up.
///
/// [`Receiver`]: struct.Receiver.html
/// [`next`]: ../../../std/iter/trait.Iterator.html#tymethod.next
/// [`None`]: ../../../std/option/enum.Option.html#variant.None
/// [`next`]: Iterator::next
///
/// # Examples
///
Expand Down Expand Up @@ -447,8 +430,7 @@ pub struct IntoIter<T> {
///
/// Messages can be sent through this channel with [`send`].
///
/// [`channel`]: fn.channel.html
/// [`send`]: struct.Sender.html#method.send
/// [`send`]: Sender::send
///
/// # Examples
///
Expand Down Expand Up @@ -493,9 +475,8 @@ impl<T> !Sync for Sender<T> {}
///
/// [`send`] will block if there is no space in the internal buffer.
///
/// [`sync_channel`]: fn.sync_channel.html
/// [`send`]: struct.SyncSender.html#method.send
/// [`try_send`]: struct.SyncSender.html#method.try_send
/// [`send`]: SyncSender::send
/// [`try_send`]: SyncSender::try_send
///
/// # Examples
///
Expand Down Expand Up @@ -549,8 +530,8 @@ unsafe impl<T: Send> Send for SyncSender<T> {}
/// disconnected, implying that the data could never be received. The error
/// contains the data being sent as a payload so it can be recovered.
///
/// [`Sender::send`]: struct.Sender.html#method.send
/// [`SyncSender::send`]: struct.SyncSender.html#method.send
/// [`Sender::send`]: Sender::send
/// [`SyncSender::send`]: SyncSender::send
#[stable(feature = "rust1", since = "1.0.0")]
#[derive(PartialEq, Eq, Clone, Copy)]
pub struct SendError<T>(#[stable(feature = "rust1", since = "1.0.0")] pub T);
Expand All @@ -561,10 +542,7 @@ pub struct SendError<T>(#[stable(feature = "rust1", since = "1.0.0")] pub T);
/// [`channel`] (or [`sync_channel`]) is disconnected, implying that no further
/// messages will ever be received.
///
/// [`recv`]: struct.Receiver.html#method.recv
/// [`Receiver`]: struct.Receiver.html
/// [`channel`]: fn.channel.html
/// [`sync_channel`]: fn.sync_channel.html
/// [`recv`]: Receiver::recv
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct RecvError;
Expand All @@ -573,9 +551,7 @@ pub struct RecvError;
/// not return data when called. This can occur with both a [`channel`] and
/// a [`sync_channel`].
///
/// [`try_recv`]: struct.Receiver.html#method.try_recv
/// [`channel`]: fn.channel.html
/// [`sync_channel`]: fn.sync_channel.html
/// [`try_recv`]: Receiver::try_recv
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
#[stable(feature = "rust1", since = "1.0.0")]
pub enum TryRecvError {
Expand All @@ -594,9 +570,7 @@ pub enum TryRecvError {
/// unable to return data when called. This can occur with both a [`channel`] and
/// a [`sync_channel`].
///
/// [`recv_timeout`]: struct.Receiver.html#method.recv_timeout
/// [`channel`]: fn.channel.html
/// [`sync_channel`]: fn.sync_channel.html
/// [`recv_timeout`]: Receiver::recv_timeout
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
#[stable(feature = "mpsc_recv_timeout", since = "1.12.0")]
pub enum RecvTimeoutError {
Expand All @@ -613,7 +587,7 @@ pub enum RecvTimeoutError {
/// This enumeration is the list of the possible error outcomes for the
/// [`try_send`] method.
///
/// [`try_send`]: struct.SyncSender.html#method.try_send
/// [`try_send`]: SyncSender::try_send
#[stable(feature = "rust1", since = "1.0.0")]
#[derive(PartialEq, Eq, Clone, Copy)]
pub enum TrySendError<T> {
Expand All @@ -623,16 +597,11 @@ pub enum TrySendError<T> {
/// If this is a buffered channel, then the buffer is full at this time. If
/// this is not a buffered channel, then there is no [`Receiver`] available to
/// acquire the data.
///
/// [`sync_channel`]: fn.sync_channel.html
/// [`Receiver`]: struct.Receiver.html
#[stable(feature = "rust1", since = "1.0.0")]
Full(#[stable(feature = "rust1", since = "1.0.0")] T),

/// This [`sync_channel`]'s receiving half has disconnected, so the data could not be
/// sent. The data is returned back to the callee in this case.
///
/// [`sync_channel`]: fn.sync_channel.html
#[stable(feature = "rust1", since = "1.0.0")]
Disconnected(#[stable(feature = "rust1", since = "1.0.0")] T),
}
Expand Down Expand Up @@ -680,13 +649,8 @@ impl<T> UnsafeFlavor<T> for Receiver<T> {
/// [`Sender`] is disconnected while trying to [`recv`], the [`recv`] method will
/// return a [`RecvError`].
///
/// [`send`]: struct.Sender.html#method.send
/// [`recv`]: struct.Receiver.html#method.recv
/// [`Sender`]: struct.Sender.html
/// [`Receiver`]: struct.Receiver.html
/// [`sync_channel`]: fn.sync_channel.html
/// [`SendError`]: struct.SendError.html
/// [`RecvError`]: struct.RecvError.html
/// [`send`]: Sender::send
/// [`recv`]: Receiver::recv
///
/// # Examples
///
Expand Down Expand Up @@ -733,13 +697,8 @@ pub fn channel<T>() -> (Sender<T>, Receiver<T>) {
/// [`SendError`]. Similarly, If the [`SyncSender`] is disconnected while trying
/// to [`recv`], the [`recv`] method will return a [`RecvError`].
///
/// [`channel`]: fn.channel.html
/// [`send`]: struct.SyncSender.html#method.send
/// [`recv`]: struct.Receiver.html#method.recv
/// [`SyncSender`]: struct.SyncSender.html
/// [`Receiver`]: struct.Receiver.html
/// [`SendError`]: struct.SendError.html
/// [`RecvError`]: struct.RecvError.html
/// [`send`]: SyncSender::send
/// [`recv`]: Receiver::recv
///
/// # Examples
///
Expand Down Expand Up @@ -786,9 +745,6 @@ impl<T> Sender<T> {
/// will be received. It is possible for the corresponding receiver to
/// hang up immediately after this function returns [`Ok`].
///
/// [`Err`]: ../../../std/result/enum.Result.html#variant.Err
/// [`Ok`]: ../../../std/result/enum.Result.html#variant.Ok
///
/// This method will never block the current thread.
///
/// # Examples
Expand Down Expand Up @@ -933,9 +889,6 @@ impl<T> SyncSender<T> {
/// [`Receiver`] has disconnected and is no longer able to receive
/// information.
///
/// [`Err`]: ../../../std/result/enum.Result.html#variant.Err
/// [`Receiver`]: ../../../std/sync/mpsc/struct.Receiver.html
///
/// # Examples
///
/// ```rust
Expand Down Expand Up @@ -971,7 +924,7 @@ impl<T> SyncSender<T> {
/// See [`send`] for notes about guarantees of whether the
/// receiver has received the data or not if this function is successful.
///
/// [`send`]: ../../../std/sync/mpsc/struct.SyncSender.html#method.send
/// [`send`]: Self::send
///
/// # Examples
///
Expand Down Expand Up @@ -1059,7 +1012,7 @@ impl<T> Receiver<T> {
/// Compared with [`recv`], this function has two failure cases instead of one
/// (one for disconnection, one for an empty buffer).
///
/// [`recv`]: struct.Receiver.html#method.recv
/// [`recv`]: Self::recv
///
/// # Examples
///
Expand Down Expand Up @@ -1117,10 +1070,6 @@ impl<T> Receiver<T> {
/// However, since channels are buffered, messages sent before the disconnect
/// will still be properly received.
///
/// [`Sender`]: struct.Sender.html
/// [`SyncSender`]: struct.SyncSender.html
/// [`Err`]: ../../../std/result/enum.Result.html#variant.Err
///
/// # Examples
///
/// ```
Expand Down Expand Up @@ -1203,10 +1152,6 @@ impl<T> Receiver<T> {
/// However, since channels are buffered, messages sent before the disconnect
/// will still be properly received.
///
/// [`Sender`]: struct.Sender.html
/// [`SyncSender`]: struct.SyncSender.html
/// [`Err`]: ../../../std/result/enum.Result.html#variant.Err
///
/// # Known Issues
///
/// There is currently a known issue (see [`#39364`]) that causes `recv_timeout`
Expand Down Expand Up @@ -1304,10 +1249,6 @@ impl<T> Receiver<T> {
/// However, since channels are buffered, messages sent before the disconnect
/// will still be properly received.
///
/// [`Sender`]: struct.Sender.html
/// [`SyncSender`]: struct.SyncSender.html
/// [`Err`]: ../../../std/result/enum.Result.html#variant.Err
///
/// # Examples
///
/// Successfully receiving value before reaching deadline:
Expand Down Expand Up @@ -1397,9 +1338,6 @@ impl<T> Receiver<T> {
/// Returns an iterator that will block waiting for messages, but never
/// [`panic!`]. It will return [`None`] when the channel has hung up.
///
/// [`panic!`]: ../../../std/macro.panic.html
/// [`None`]: ../../../std/option/enum.Option.html#variant.None
///
/// # Examples
///
/// ```rust
Expand Down Expand Up @@ -1430,8 +1368,6 @@ impl<T> Receiver<T> {
/// channel has hung up. The iterator will never [`panic!`] or block the
/// user by waiting for values.
///
/// [`panic!`]: ../../../std/macro.panic.html
///
/// # Examples
///
/// ```no_run
Expand Down
Loading