Skip to content

Commit c5a8b7b

Browse files
committed
Auto merge of #75790 - LeSeulArtichaut:std-intra-doc, r=jyn514
Use intra-doc-links in `std::sync::*` Helps with #75080. r? @jyn514
2 parents b1bb8aa + f3a832f commit c5a8b7b

File tree

4 files changed

+53
-136
lines changed

4 files changed

+53
-136
lines changed

library/std/src/sync/condvar.rs

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::time::{Duration, Instant};
1111
///
1212
/// It is returned by the [`wait_timeout`] method.
1313
///
14-
/// [`wait_timeout`]: struct.Condvar.html#method.wait_timeout
14+
/// [`wait_timeout`]: Condvar::wait_timeout
1515
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
1616
#[stable(feature = "wait_timeout", since = "1.5.0")]
1717
pub struct WaitTimeoutResult(bool);
@@ -161,11 +161,10 @@ impl Condvar {
161161
/// mutex to ensure defined behavior across platforms. If this functionality
162162
/// is not desired, then unsafe primitives in `sys` are provided.
163163
///
164-
/// [`notify_one`]: #method.notify_one
165-
/// [`notify_all`]: #method.notify_all
166-
/// [poisoning]: ../sync/struct.Mutex.html#poisoning
167-
/// [`Mutex`]: ../sync/struct.Mutex.html
168-
/// [`panic!`]: ../../std/macro.panic.html
164+
/// [`notify_one`]: Self::notify_one
165+
/// [`notify_all`]: Self::notify_all
166+
/// [poisoning]: super::Mutex#poisoning
167+
/// [`Mutex`]: super::Mutex
169168
///
170169
/// # Examples
171170
///
@@ -218,10 +217,10 @@ impl Condvar {
218217
/// poisoned when this thread re-acquires the lock. For more information,
219218
/// see information about [poisoning] on the [`Mutex`] type.
220219
///
221-
/// [`notify_one`]: #method.notify_one
222-
/// [`notify_all`]: #method.notify_all
223-
/// [poisoning]: ../sync/struct.Mutex.html#poisoning
224-
/// [`Mutex`]: ../sync/struct.Mutex.html
220+
/// [`notify_one`]: Self::notify_one
221+
/// [`notify_all`]: Self::notify_all
222+
/// [poisoning]: super::Mutex#poisoning
223+
/// [`Mutex`]: super::Mutex
225224
///
226225
/// # Examples
227226
///
@@ -280,7 +279,7 @@ impl Condvar {
280279
/// Like [`wait`], the lock specified will be re-acquired when this function
281280
/// returns, regardless of whether the timeout elapsed or not.
282281
///
283-
/// [`wait`]: #method.wait
282+
/// [`wait`]: Self::wait
284283
///
285284
/// # Examples
286285
///
@@ -350,9 +349,8 @@ impl Condvar {
350349
/// Like [`wait`], the lock specified will be re-acquired when this function
351350
/// returns, regardless of whether the timeout elapsed or not.
352351
///
353-
/// [`wait`]: #method.wait
354-
/// [`wait_timeout_while`]: #method.wait_timeout_while
355-
/// [`WaitTimeoutResult`]: struct.WaitTimeoutResult.html
352+
/// [`wait`]: Self::wait
353+
/// [`wait_timeout_while`]: Self::wait_timeout_while
356354
///
357355
/// # Examples
358356
///
@@ -420,9 +418,8 @@ impl Condvar {
420418
/// Like [`wait_while`], the lock specified will be re-acquired when this
421419
/// function returns, regardless of whether the timeout elapsed or not.
422420
///
423-
/// [`wait_while`]: #method.wait_while
424-
/// [`wait_timeout`]: #method.wait_timeout
425-
/// [`WaitTimeoutResult`]: struct.WaitTimeoutResult.html
421+
/// [`wait_while`]: Self::wait_while
422+
/// [`wait_timeout`]: Self::wait_timeout
426423
///
427424
/// # Examples
428425
///
@@ -485,9 +482,9 @@ impl Condvar {
485482
///
486483
/// To wake up all threads, see [`notify_all`].
487484
///
488-
/// [`wait`]: #method.wait
489-
/// [`wait_timeout`]: #method.wait_timeout
490-
/// [`notify_all`]: #method.notify_all
485+
/// [`wait`]: Self::wait
486+
/// [`wait_timeout`]: Self::wait_timeout
487+
/// [`notify_all`]: Self::notify_all
491488
///
492489
/// # Examples
493490
///
@@ -527,7 +524,7 @@ impl Condvar {
527524
///
528525
/// To wake up only one thread, see [`notify_one`].
529526
///
530-
/// [`notify_one`]: #method.notify_one
527+
/// [`notify_one`]: Self::notify_one
531528
///
532529
/// # Examples
533530
///

library/std/src/sync/mpsc/mod.rs

Lines changed: 22 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// ignore-tidy-filelength
2-
31
//! Multi-producer, single-consumer FIFO queue communication primitives.
42
//!
53
//! This module provides message-based communication over channels, concretely
@@ -27,12 +25,7 @@
2725
//! that a bound of 0 is allowed, causing the channel to become a "rendezvous"
2826
//! channel where each sender atomically hands off a message to a receiver.
2927
//!
30-
//! [`Sender`]: ../../../std/sync/mpsc/struct.Sender.html
31-
//! [`SyncSender`]: ../../../std/sync/mpsc/struct.SyncSender.html
32-
//! [`Receiver`]: ../../../std/sync/mpsc/struct.Receiver.html
33-
//! [`send`]: ../../../std/sync/mpsc/struct.Sender.html#method.send
34-
//! [`channel`]: ../../../std/sync/mpsc/fn.channel.html
35-
//! [`sync_channel`]: ../../../std/sync/mpsc/fn.sync_channel.html
28+
//! [`send`]: Sender::send
3629
//!
3730
//! ## Disconnection
3831
//!
@@ -46,9 +39,7 @@
4639
//! will continue to [`unwrap`] the results returned from this module,
4740
//! instigating a propagation of failure among threads if one unexpectedly dies.
4841
//!
49-
//! [`Result`]: ../../../std/result/enum.Result.html
50-
//! [`Err`]: ../../../std/result/enum.Result.html#variant.Err
51-
//! [`unwrap`]: ../../../std/result/enum.Result.html#method.unwrap
42+
//! [`unwrap`]: Result::unwrap
5243
//!
5344
//! # Examples
5445
//!
@@ -291,9 +282,7 @@ mod cache_aligned;
291282
///
292283
/// Messages sent to the channel can be retrieved using [`recv`].
293284
///
294-
/// [`channel`]: fn.channel.html
295-
/// [`sync_channel`]: fn.sync_channel.html
296-
/// [`recv`]: struct.Receiver.html#method.recv
285+
/// [`recv`]: Receiver::recv
297286
///
298287
/// # Examples
299288
///
@@ -333,10 +322,8 @@ impl<T> !Sync for Receiver<T> {}
333322
/// waiting for a new message, and [`None`] will be returned
334323
/// when the corresponding channel has hung up.
335324
///
336-
/// [`iter`]: struct.Receiver.html#method.iter
337-
/// [`Receiver`]: struct.Receiver.html
338-
/// [`next`]: ../../../std/iter/trait.Iterator.html#tymethod.next
339-
/// [`None`]: ../../../std/option/enum.Option.html#variant.None
325+
/// [`iter`]: Receiver::iter
326+
/// [`next`]: Iterator::next
340327
///
341328
/// # Examples
342329
///
@@ -371,9 +358,7 @@ pub struct Iter<'a, T: 'a> {
371358
/// This iterator will never block the caller in order to wait for data to
372359
/// become available. Instead, it will return [`None`].
373360
///
374-
/// [`Receiver`]: struct.Receiver.html
375-
/// [`try_iter`]: struct.Receiver.html#method.try_iter
376-
/// [`None`]: ../../../std/option/enum.Option.html#variant.None
361+
/// [`try_iter`]: Receiver::try_iter
377362
///
378363
/// # Examples
379364
///
@@ -414,9 +399,7 @@ pub struct TryIter<'a, T: 'a> {
414399
/// is called, waiting for a new message, and [`None`] will be
415400
/// returned if the corresponding channel has hung up.
416401
///
417-
/// [`Receiver`]: struct.Receiver.html
418-
/// [`next`]: ../../../std/iter/trait.Iterator.html#tymethod.next
419-
/// [`None`]: ../../../std/option/enum.Option.html#variant.None
402+
/// [`next`]: Iterator::next
420403
///
421404
/// # Examples
422405
///
@@ -447,8 +430,7 @@ pub struct IntoIter<T> {
447430
///
448431
/// Messages can be sent through this channel with [`send`].
449432
///
450-
/// [`channel`]: fn.channel.html
451-
/// [`send`]: struct.Sender.html#method.send
433+
/// [`send`]: Sender::send
452434
///
453435
/// # Examples
454436
///
@@ -493,9 +475,8 @@ impl<T> !Sync for Sender<T> {}
493475
///
494476
/// [`send`] will block if there is no space in the internal buffer.
495477
///
496-
/// [`sync_channel`]: fn.sync_channel.html
497-
/// [`send`]: struct.SyncSender.html#method.send
498-
/// [`try_send`]: struct.SyncSender.html#method.try_send
478+
/// [`send`]: SyncSender::send
479+
/// [`try_send`]: SyncSender::try_send
499480
///
500481
/// # Examples
501482
///
@@ -549,8 +530,8 @@ unsafe impl<T: Send> Send for SyncSender<T> {}
549530
/// disconnected, implying that the data could never be received. The error
550531
/// contains the data being sent as a payload so it can be recovered.
551532
///
552-
/// [`Sender::send`]: struct.Sender.html#method.send
553-
/// [`SyncSender::send`]: struct.SyncSender.html#method.send
533+
/// [`Sender::send`]: Sender::send
534+
/// [`SyncSender::send`]: SyncSender::send
554535
#[stable(feature = "rust1", since = "1.0.0")]
555536
#[derive(PartialEq, Eq, Clone, Copy)]
556537
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);
561542
/// [`channel`] (or [`sync_channel`]) is disconnected, implying that no further
562543
/// messages will ever be received.
563544
///
564-
/// [`recv`]: struct.Receiver.html#method.recv
565-
/// [`Receiver`]: struct.Receiver.html
566-
/// [`channel`]: fn.channel.html
567-
/// [`sync_channel`]: fn.sync_channel.html
545+
/// [`recv`]: Receiver::recv
568546
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
569547
#[stable(feature = "rust1", since = "1.0.0")]
570548
pub struct RecvError;
@@ -573,9 +551,7 @@ pub struct RecvError;
573551
/// not return data when called. This can occur with both a [`channel`] and
574552
/// a [`sync_channel`].
575553
///
576-
/// [`try_recv`]: struct.Receiver.html#method.try_recv
577-
/// [`channel`]: fn.channel.html
578-
/// [`sync_channel`]: fn.sync_channel.html
554+
/// [`try_recv`]: Receiver::try_recv
579555
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
580556
#[stable(feature = "rust1", since = "1.0.0")]
581557
pub enum TryRecvError {
@@ -594,9 +570,7 @@ pub enum TryRecvError {
594570
/// unable to return data when called. This can occur with both a [`channel`] and
595571
/// a [`sync_channel`].
596572
///
597-
/// [`recv_timeout`]: struct.Receiver.html#method.recv_timeout
598-
/// [`channel`]: fn.channel.html
599-
/// [`sync_channel`]: fn.sync_channel.html
573+
/// [`recv_timeout`]: Receiver::recv_timeout
600574
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
601575
#[stable(feature = "mpsc_recv_timeout", since = "1.12.0")]
602576
pub enum RecvTimeoutError {
@@ -613,7 +587,7 @@ pub enum RecvTimeoutError {
613587
/// This enumeration is the list of the possible error outcomes for the
614588
/// [`try_send`] method.
615589
///
616-
/// [`try_send`]: struct.SyncSender.html#method.try_send
590+
/// [`try_send`]: SyncSender::try_send
617591
#[stable(feature = "rust1", since = "1.0.0")]
618592
#[derive(PartialEq, Eq, Clone, Copy)]
619593
pub enum TrySendError<T> {
@@ -623,16 +597,11 @@ pub enum TrySendError<T> {
623597
/// If this is a buffered channel, then the buffer is full at this time. If
624598
/// this is not a buffered channel, then there is no [`Receiver`] available to
625599
/// acquire the data.
626-
///
627-
/// [`sync_channel`]: fn.sync_channel.html
628-
/// [`Receiver`]: struct.Receiver.html
629600
#[stable(feature = "rust1", since = "1.0.0")]
630601
Full(#[stable(feature = "rust1", since = "1.0.0")] T),
631602

632603
/// This [`sync_channel`]'s receiving half has disconnected, so the data could not be
633604
/// sent. The data is returned back to the callee in this case.
634-
///
635-
/// [`sync_channel`]: fn.sync_channel.html
636605
#[stable(feature = "rust1", since = "1.0.0")]
637606
Disconnected(#[stable(feature = "rust1", since = "1.0.0")] T),
638607
}
@@ -680,13 +649,8 @@ impl<T> UnsafeFlavor<T> for Receiver<T> {
680649
/// [`Sender`] is disconnected while trying to [`recv`], the [`recv`] method will
681650
/// return a [`RecvError`].
682651
///
683-
/// [`send`]: struct.Sender.html#method.send
684-
/// [`recv`]: struct.Receiver.html#method.recv
685-
/// [`Sender`]: struct.Sender.html
686-
/// [`Receiver`]: struct.Receiver.html
687-
/// [`sync_channel`]: fn.sync_channel.html
688-
/// [`SendError`]: struct.SendError.html
689-
/// [`RecvError`]: struct.RecvError.html
652+
/// [`send`]: Sender::send
653+
/// [`recv`]: Receiver::recv
690654
///
691655
/// # Examples
692656
///
@@ -733,13 +697,8 @@ pub fn channel<T>() -> (Sender<T>, Receiver<T>) {
733697
/// [`SendError`]. Similarly, If the [`SyncSender`] is disconnected while trying
734698
/// to [`recv`], the [`recv`] method will return a [`RecvError`].
735699
///
736-
/// [`channel`]: fn.channel.html
737-
/// [`send`]: struct.SyncSender.html#method.send
738-
/// [`recv`]: struct.Receiver.html#method.recv
739-
/// [`SyncSender`]: struct.SyncSender.html
740-
/// [`Receiver`]: struct.Receiver.html
741-
/// [`SendError`]: struct.SendError.html
742-
/// [`RecvError`]: struct.RecvError.html
700+
/// [`send`]: SyncSender::send
701+
/// [`recv`]: Receiver::recv
743702
///
744703
/// # Examples
745704
///
@@ -786,9 +745,6 @@ impl<T> Sender<T> {
786745
/// will be received. It is possible for the corresponding receiver to
787746
/// hang up immediately after this function returns [`Ok`].
788747
///
789-
/// [`Err`]: ../../../std/result/enum.Result.html#variant.Err
790-
/// [`Ok`]: ../../../std/result/enum.Result.html#variant.Ok
791-
///
792748
/// This method will never block the current thread.
793749
///
794750
/// # Examples
@@ -933,9 +889,6 @@ impl<T> SyncSender<T> {
933889
/// [`Receiver`] has disconnected and is no longer able to receive
934890
/// information.
935891
///
936-
/// [`Err`]: ../../../std/result/enum.Result.html#variant.Err
937-
/// [`Receiver`]: ../../../std/sync/mpsc/struct.Receiver.html
938-
///
939892
/// # Examples
940893
///
941894
/// ```rust
@@ -971,7 +924,7 @@ impl<T> SyncSender<T> {
971924
/// See [`send`] for notes about guarantees of whether the
972925
/// receiver has received the data or not if this function is successful.
973926
///
974-
/// [`send`]: ../../../std/sync/mpsc/struct.SyncSender.html#method.send
927+
/// [`send`]: Self::send
975928
///
976929
/// # Examples
977930
///
@@ -1059,7 +1012,7 @@ impl<T> Receiver<T> {
10591012
/// Compared with [`recv`], this function has two failure cases instead of one
10601013
/// (one for disconnection, one for an empty buffer).
10611014
///
1062-
/// [`recv`]: struct.Receiver.html#method.recv
1015+
/// [`recv`]: Self::recv
10631016
///
10641017
/// # Examples
10651018
///
@@ -1117,10 +1070,6 @@ impl<T> Receiver<T> {
11171070
/// However, since channels are buffered, messages sent before the disconnect
11181071
/// will still be properly received.
11191072
///
1120-
/// [`Sender`]: struct.Sender.html
1121-
/// [`SyncSender`]: struct.SyncSender.html
1122-
/// [`Err`]: ../../../std/result/enum.Result.html#variant.Err
1123-
///
11241073
/// # Examples
11251074
///
11261075
/// ```
@@ -1203,10 +1152,6 @@ impl<T> Receiver<T> {
12031152
/// However, since channels are buffered, messages sent before the disconnect
12041153
/// will still be properly received.
12051154
///
1206-
/// [`Sender`]: struct.Sender.html
1207-
/// [`SyncSender`]: struct.SyncSender.html
1208-
/// [`Err`]: ../../../std/result/enum.Result.html#variant.Err
1209-
///
12101155
/// # Known Issues
12111156
///
12121157
/// There is currently a known issue (see [`#39364`]) that causes `recv_timeout`
@@ -1304,10 +1249,6 @@ impl<T> Receiver<T> {
13041249
/// However, since channels are buffered, messages sent before the disconnect
13051250
/// will still be properly received.
13061251
///
1307-
/// [`Sender`]: struct.Sender.html
1308-
/// [`SyncSender`]: struct.SyncSender.html
1309-
/// [`Err`]: ../../../std/result/enum.Result.html#variant.Err
1310-
///
13111252
/// # Examples
13121253
///
13131254
/// Successfully receiving value before reaching deadline:
@@ -1397,9 +1338,6 @@ impl<T> Receiver<T> {
13971338
/// Returns an iterator that will block waiting for messages, but never
13981339
/// [`panic!`]. It will return [`None`] when the channel has hung up.
13991340
///
1400-
/// [`panic!`]: ../../../std/macro.panic.html
1401-
/// [`None`]: ../../../std/option/enum.Option.html#variant.None
1402-
///
14031341
/// # Examples
14041342
///
14051343
/// ```rust
@@ -1430,8 +1368,6 @@ impl<T> Receiver<T> {
14301368
/// channel has hung up. The iterator will never [`panic!`] or block the
14311369
/// user by waiting for values.
14321370
///
1433-
/// [`panic!`]: ../../../std/macro.panic.html
1434-
///
14351371
/// # Examples
14361372
///
14371373
/// ```no_run

0 commit comments

Comments
 (0)