Skip to content

Commit 8249004

Browse files
authored
Rollup merge of #45017 - GuillaumeGomez:mutex-links, r=estebank
Add missing urls for Mutex r? @rust-lang/docs
2 parents 71fba53 + e1df72f commit 8249004

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

src/libstd/sync/mutex.rs

+17-7
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ use sys_common::poison::{self, TryLockError, TryLockResult, LockResult};
1919
/// A mutual exclusion primitive useful for protecting shared data
2020
///
2121
/// This mutex will block threads waiting for the lock to become available. The
22-
/// mutex can also be statically initialized or created via a `new`
22+
/// mutex can also be statically initialized or created via a [`new`]
2323
/// constructor. Each mutex has a type parameter which represents the data that
2424
/// it is protecting. The data can only be accessed through the RAII guards
25-
/// returned from `lock` and `try_lock`, which guarantees that the data is only
25+
/// returned from [`lock`] and [`try_lock`], which guarantees that the data is only
2626
/// ever accessed when the mutex is locked.
2727
///
2828
/// # Poisoning
@@ -33,16 +33,24 @@ use sys_common::poison::{self, TryLockError, TryLockResult, LockResult};
3333
/// data by default as it is likely tainted (some invariant is not being
3434
/// upheld).
3535
///
36-
/// For a mutex, this means that the `lock` and `try_lock` methods return a
37-
/// `Result` which indicates whether a mutex has been poisoned or not. Most
38-
/// usage of a mutex will simply `unwrap()` these results, propagating panics
36+
/// For a mutex, this means that the [`lock`] and [`try_lock`] methods return a
37+
/// [`Result`] which indicates whether a mutex has been poisoned or not. Most
38+
/// usage of a mutex will simply [`unwrap()`] these results, propagating panics
3939
/// among threads to ensure that a possibly invalid invariant is not witnessed.
4040
///
4141
/// A poisoned mutex, however, does not prevent all access to the underlying
42-
/// data. The `PoisonError` type has an `into_inner` method which will return
42+
/// data. The [`PoisonError`] type has an [`into_inner`] method which will return
4343
/// the guard that would have otherwise been returned on a successful lock. This
4444
/// allows access to the data, despite the lock being poisoned.
4545
///
46+
/// [`new`]: #method.new
47+
/// [`lock`]: #method.lock
48+
/// [`try_lock`]: #method.try_lock
49+
/// [`Result`]: ../../std/result/enum.Result.html
50+
/// [`unwrap()`]: ../../std/result/enum.Result.html#method.unwrap
51+
/// [`PoisonError`]: ../../std/sync/struct.PoisonError.html
52+
/// [`into_inner`]: ../../std/sync/struct.PoisonError.html#method.into_inner
53+
///
4654
/// # Examples
4755
///
4856
/// ```
@@ -226,7 +234,7 @@ impl<T: ?Sized> Mutex<T> {
226234

227235
/// Attempts to acquire this lock.
228236
///
229-
/// If the lock could not be acquired at this time, then `Err` is returned.
237+
/// If the lock could not be acquired at this time, then [`Err`] is returned.
230238
/// Otherwise, an RAII guard is returned. The lock will be unlocked when the
231239
/// guard is dropped.
232240
///
@@ -238,6 +246,8 @@ impl<T: ?Sized> Mutex<T> {
238246
/// this call will return failure if the mutex would otherwise be
239247
/// acquired.
240248
///
249+
/// [`Err`]: ../../std/result/enum.Result.html#variant.Err
250+
///
241251
/// # Examples
242252
///
243253
/// ```

0 commit comments

Comments
 (0)