diff options
| author | Surya Midatala <surya.midatala@protonmail.com> | 2020-08-23 21:13:14 +0530 |
|---|---|---|
| committer | Surya Midatala <surya.midatala@protonmail.com> | 2020-08-26 21:43:46 +0530 |
| commit | f10ab9139125a4a791e40dc2e51b5a4b06c22ea9 (patch) | |
| tree | f61c792026717ce3350a9de40d772cb0d908f8b1 | |
| parent | b3437f36e0d2c8c172344e35fbe2a01ca10de4e2 (diff) | |
| download | rust-f10ab9139125a4a791e40dc2e51b5a4b06c22ea9.tar.gz rust-f10ab9139125a4a791e40dc2e51b5a4b06c22ea9.zip | |
Add suggestions from code review
| -rw-r--r-- | library/std/src/primitive_docs.rs | 12 | ||||
| -rw-r--r-- | library/std/src/sys_common/poison.rs | 17 |
2 files changed, 12 insertions, 17 deletions
diff --git a/library/std/src/primitive_docs.rs b/library/std/src/primitive_docs.rs index 297c8318474..0752ba0bfea 100644 --- a/library/std/src/primitive_docs.rs +++ b/library/std/src/primitive_docs.rs @@ -99,7 +99,7 @@ mod prim_bool {} /// at all we know it can never produce a value which isn't a [`u32`]. This illustrates another /// behaviour of the `!` type - expressions with type `!` will coerce into any other type. /// -/// [`exit`]: crate::process::exit +/// [`exit`]: process::exit /// /// # `!` and generics /// @@ -354,7 +354,7 @@ mod prim_unit {} // /// Raw, unsafe pointers, `*const T`, and `*mut T`. /// -/// *[See also the `std::ptr` module][`crate::ptr`].* +/// *[See also the `std::ptr` module][`ptr`].* /// /// Working with raw pointers in Rust is uncommon, typically limited to a few patterns. /// Raw pointers can be unaligned or [`null`]. However, when a raw pointer is @@ -545,7 +545,7 @@ mod prim_array {} /// means that elements are laid out so that every element is the same /// distance from its neighbors. /// -/// *[See also the `std::slice` module][`crate::slice`].* +/// *[See also the `std::slice` module][`slice`].* /// /// Slices are a view into a block of memory represented as a pointer and a /// length. @@ -590,7 +590,7 @@ mod prim_slice {} // /// String slices. /// -/// *[See also the `std::str` module][`crate::str`].* +/// *[See also the `std::str` module][`str`].* /// /// The `str` type, also called a 'string slice', is the most primitive string /// type. It is usually seen in its borrowed form, `&str`. It is also the type @@ -785,7 +785,7 @@ mod prim_tuple {} /// /// For more information on floating point numbers, see [Wikipedia][wikipedia]. /// -/// *[See also the `std::f32::consts` module][`crate::f32::consts`].* +/// *[See also the `std::f32::consts` module][`f32::consts`].* /// /// [wikipedia]: https://en.wikipedia.org/wiki/Single-precision_floating-point_format #[stable(feature = "rust1", since = "1.0.0")] @@ -799,7 +799,7 @@ mod prim_f32 {} /// `f32`] or [Wikipedia on double precision /// values][wikipedia] for more information. /// -/// *[See also the `std::f64::consts` module][`crate::f64::consts`].* +/// *[See also the `std::f64::consts` module][`f64::consts`].* /// /// [wikipedia]: https://en.wikipedia.org/wiki/Double-precision_floating-point_format #[stable(feature = "rust1", since = "1.0.0")] diff --git a/library/std/src/sys_common/poison.rs b/library/std/src/sys_common/poison.rs index 24ccc7fc118..03119e9a373 100644 --- a/library/std/src/sys_common/poison.rs +++ b/library/std/src/sys_common/poison.rs @@ -3,6 +3,9 @@ use crate::fmt; use crate::sync::atomic::{AtomicBool, Ordering}; use crate::thread; +#[cfg(doc)] +use crate::sync::{Mutex, RwLock}; + pub struct Flag { failed: AtomicBool, } @@ -77,9 +80,6 @@ pub struct Guard { /// } /// }; /// ``` -/// -/// [`Mutex`]: crate::sync::Mutex -/// [`RwLock`]: crate::sync::RwLock #[stable(feature = "rust1", since = "1.0.0")] pub struct PoisonError<T> { guard: T, @@ -89,11 +89,9 @@ pub struct PoisonError<T> { /// can occur while trying to acquire a lock, from the [`try_lock`] method on a /// [`Mutex`] or the [`try_read`] and [`try_write`] methods on an [`RwLock`]. /// -/// [`Mutex`]: crate::sync::Mutex -/// [`RwLock`]: crate::sync::RwLock -/// [`try_lock`]: crate::sync::Mutex::try_lock -/// [`try_read`]: crate::sync::RwLock::try_read -/// [`try_write`]: crate::sync::RwLock::try_write +/// [`try_lock`]: Mutex::try_lock +/// [`try_read`]: RwLock::try_read +/// [`try_write`]: RwLock::try_write #[stable(feature = "rust1", since = "1.0.0")] pub enum TryLockError<T> { /// The lock could not be acquired because another thread failed while holding @@ -152,9 +150,6 @@ impl<T> PoisonError<T> { /// Creates a `PoisonError`. /// /// This is generally created by methods like [`Mutex::lock`] or [`RwLock::read`]. - /// - /// [`Mutex::lock`]: crate::sync::Mutex::lock - /// [`RwLock::read`]: crate::sync::RwLock::read #[stable(feature = "sync_poison", since = "1.2.0")] pub fn new(guard: T) -> PoisonError<T> { PoisonError { guard } |
