about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeSeulArtichaut <leseulartichaut@gmail.com>2020-08-22 00:26:28 +0200
committerLeSeulArtichaut <leseulartichaut@gmail.com>2020-08-22 01:28:26 +0200
commitf3a832f4b4cf9040a050caf645eaf57653b6866c (patch)
tree928cf45877b3ae4deea0310075084ea03c256b3a
parentde521cbb303c08febd9fa3755caccd4f3e491ea3 (diff)
downloadrust-f3a832f4b4cf9040a050caf645eaf57653b6866c.tar.gz
rust-f3a832f4b4cf9040a050caf645eaf57653b6866c.zip
Use intra-doc-links in `std::sync::*`
-rw-r--r--library/std/src/sync/condvar.rs39
-rw-r--r--library/std/src/sync/mpsc/mod.rs108
-rw-r--r--library/std/src/sync/mutex.rs24
-rw-r--r--library/std/src/sync/rwlock.rs18
4 files changed, 53 insertions, 136 deletions
diff --git a/library/std/src/sync/condvar.rs b/library/std/src/sync/condvar.rs
index 9b90bfd68b5..4efd86aa3ed 100644
--- a/library/std/src/sync/condvar.rs
+++ b/library/std/src/sync/condvar.rs
@@ -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);
@@ -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
     ///
@@ -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
     ///
@@ -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
     ///
@@ -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
     ///
@@ -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
     ///
@@ -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
     ///
@@ -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
     ///
diff --git a/library/std/src/sync/mpsc/mod.rs b/library/std/src/sync/mpsc/mod.rs
index 3ff50e9f213..ac83017d9e1 100644
--- a/library/std/src/sync/mpsc/mod.rs
+++ b/library/std/src/sync/mpsc/mod.rs
@@ -1,5 +1,3 @@
-// ignore-tidy-filelength
-
 //! Multi-producer, single-consumer FIFO queue communication primitives.
 //!
 //! This module provides message-based communication over channels, concretely
@@ -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
 //!
@@ -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
 //!
@@ -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
 ///
@@ -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
 ///
@@ -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
 ///
@@ -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
 ///
@@ -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
 ///
@@ -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
 ///
@@ -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);
@@ -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;
@@ -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 {
@@ -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 {
@@ -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> {
@@ -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),
 }
@@ -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
 ///
@@ -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
 ///
@@ -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
@@ -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
@@ -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
     ///
@@ -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
     ///
@@ -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
     ///
     /// ```
@@ -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`
@@ -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:
@@ -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
@@ -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
diff --git a/library/std/src/sync/mutex.rs b/library/std/src/sync/mutex.rs
index 8478457eabf..d7a4f00305c 100644
--- a/library/std/src/sync/mutex.rs
+++ b/library/std/src/sync/mutex.rs
@@ -33,13 +33,12 @@ use crate::sys_common::poison::{self, LockResult, TryLockError, TryLockResult};
 /// the guard that would have otherwise been returned on a successful lock. This
 /// allows access to the data, despite the lock being poisoned.
 ///
-/// [`new`]: #method.new
-/// [`lock`]: #method.lock
-/// [`try_lock`]: #method.try_lock
-/// [`Result`]: ../../std/result/enum.Result.html
-/// [`unwrap()`]: ../../std/result/enum.Result.html#method.unwrap
-/// [`PoisonError`]: ../../std/sync/struct.PoisonError.html
-/// [`into_inner`]: ../../std/sync/struct.PoisonError.html#method.into_inner
+/// [`new`]: Self::new
+/// [`lock`]: Self::lock
+/// [`try_lock`]: Self::try_lock
+/// [`unwrap()`]: Result::unwrap
+/// [`PoisonError`]: super::PoisonError
+/// [`into_inner`]: super::PoisonError::into_inner
 ///
 /// # Examples
 ///
@@ -190,11 +189,8 @@ unsafe impl<T: ?Sized + Send> Sync for Mutex<T> {}
 /// This structure is created by the [`lock`] and [`try_lock`] methods on
 /// [`Mutex`].
 ///
-/// [`Deref`]: ../../std/ops/trait.Deref.html
-/// [`DerefMut`]: ../../std/ops/trait.DerefMut.html
-/// [`lock`]: struct.Mutex.html#method.lock
-/// [`try_lock`]: struct.Mutex.html#method.try_lock
-/// [`Mutex`]: struct.Mutex.html
+/// [`lock`]: Mutex::lock
+/// [`try_lock`]: Mutex::try_lock
 #[must_use = "if unused the Mutex will immediately unlock"]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct MutexGuard<'a, T: ?Sized + 'a> {
@@ -289,8 +285,6 @@ impl<T: ?Sized> Mutex<T> {
     /// this call will return failure if the mutex would otherwise be
     /// acquired.
     ///
-    /// [`Err`]: ../../std/result/enum.Result.html#variant.Err
-    ///
     /// # Examples
     ///
     /// ```
@@ -432,8 +426,6 @@ unsafe impl<#[may_dangle] T: ?Sized> Drop for Mutex<T> {
 impl<T> From<T> for Mutex<T> {
     /// Creates a new mutex in an unlocked state ready for use.
     /// This is equivalent to [`Mutex::new`].
-    ///
-    /// [`Mutex::new`]: ../../std/sync/struct.Mutex.html#method.new
     fn from(t: T) -> Self {
         Mutex::new(t)
     }
diff --git a/library/std/src/sync/rwlock.rs b/library/std/src/sync/rwlock.rs
index 50f54dbf143..586093c916d 100644
--- a/library/std/src/sync/rwlock.rs
+++ b/library/std/src/sync/rwlock.rs
@@ -58,11 +58,7 @@ use crate::sys_common::rwlock as sys;
 /// } // write lock is dropped here
 /// ```
 ///
-/// [`Deref`]: ../../std/ops/trait.Deref.html
-/// [`DerefMut`]: ../../std/ops/trait.DerefMut.html
-/// [`Send`]: ../../std/marker/trait.Send.html
-/// [`Sync`]: ../../std/marker/trait.Sync.html
-/// [`Mutex`]: struct.Mutex.html
+/// [`Mutex`]: super::Mutex
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct RwLock<T: ?Sized> {
     inner: Box<sys::RWLock>,
@@ -81,9 +77,8 @@ unsafe impl<T: ?Sized + Send + Sync> Sync for RwLock<T> {}
 /// This structure is created by the [`read`] and [`try_read`] methods on
 /// [`RwLock`].
 ///
-/// [`read`]: struct.RwLock.html#method.read
-/// [`try_read`]: struct.RwLock.html#method.try_read
-/// [`RwLock`]: struct.RwLock.html
+/// [`read`]: RwLock::read
+/// [`try_read`]: RwLock::try_read
 #[must_use = "if unused the RwLock will immediately unlock"]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct RwLockReadGuard<'a, T: ?Sized + 'a> {
@@ -102,9 +97,8 @@ unsafe impl<T: ?Sized + Sync> Sync for RwLockReadGuard<'_, T> {}
 /// This structure is created by the [`write`] and [`try_write`] methods
 /// on [`RwLock`].
 ///
-/// [`write`]: struct.RwLock.html#method.write
-/// [`try_write`]: struct.RwLock.html#method.try_write
-/// [`RwLock`]: struct.RwLock.html
+/// [`write`]: RwLock::write
+/// [`try_write`]: RwLock::try_write
 #[must_use = "if unused the RwLock will immediately unlock"]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct RwLockWriteGuard<'a, T: ?Sized + 'a> {
@@ -456,8 +450,6 @@ impl<T: Default> Default for RwLock<T> {
 impl<T> From<T> for RwLock<T> {
     /// Creates a new instance of an `RwLock<T>` which is unlocked.
     /// This is equivalent to [`RwLock::new`].
-    ///
-    /// [`RwLock::new`]: ../../std/sync/struct.RwLock.html#method.new
     fn from(t: T) -> Self {
         RwLock::new(t)
     }