Skip to content
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

Add missing links for AtomicBool #45053

Merged
merged 1 commit into from
Oct 8, 2017
Merged
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
17 changes: 12 additions & 5 deletions src/libcore/sync/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ pub fn hint_core_should_pause()

/// A boolean type which can be safely shared between threads.
///
/// This type has the same in-memory representation as a `bool`.
/// This type has the same in-memory representation as a [`bool`].
///
/// [`bool`]: ../../../std/primitive.bool.html
#[cfg(target_has_atomic = "8")]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct AtomicBool {
Expand Down Expand Up @@ -246,11 +248,13 @@ impl AtomicBool {
AtomicBool { v: UnsafeCell::new(v as u8) }
}

/// Returns a mutable reference to the underlying `bool`.
/// Returns a mutable reference to the underlying [`bool`].
///
/// This is safe because the mutable reference guarantees that no other threads are
/// concurrently accessing the atomic data.
///
/// [`bool`]: ../../../std/primitive.bool.html
///
/// # Examples
///
/// ```
Expand Down Expand Up @@ -369,7 +373,7 @@ impl AtomicBool {
unsafe { atomic_swap(self.v.get(), val as u8, order) != 0 }
}

/// Stores a value into the `bool` if the current value is the same as the `current` value.
/// Stores a value into the [`bool`] if the current value is the same as the `current` value.
///
/// The return value is always the previous value. If it is equal to `current`, then the value
/// was updated.
Expand All @@ -378,6 +382,7 @@ impl AtomicBool {
/// ordering of this operation.
///
/// [`Ordering`]: enum.Ordering.html
/// [`bool`]: ../../../std/primitive.bool.html
///
/// # Examples
///
Expand All @@ -401,7 +406,7 @@ impl AtomicBool {
}
}

/// Stores a value into the `bool` if the current value is the same as the `current` value.
/// Stores a value into the [`bool`] if the current value is the same as the `current` value.
///
/// The return value is a result indicating whether the new value was written and containing
/// the previous value. On success this value is guaranteed to be equal to `current`.
Expand All @@ -412,6 +417,7 @@ impl AtomicBool {
/// operation fails. The failure ordering can't be [`Release`] or [`AcqRel`] and must
/// be equivalent or weaker than the success ordering.
///
/// [`bool`]: ../../../std/primitive.bool.html
/// [`Ordering`]: enum.Ordering.html
/// [`Release`]: enum.Ordering.html#variant.Release
/// [`AcqRel`]: enum.Ordering.html#variant.Release
Expand Down Expand Up @@ -452,7 +458,7 @@ impl AtomicBool {
}
}

/// Stores a value into the `bool` if the current value is the same as the `current` value.
/// Stores a value into the [`bool`] if the current value is the same as the `current` value.
///
/// Unlike [`compare_exchange`], this function is allowed to spuriously fail even when the
/// comparison succeeds, which can result in more efficient code on some platforms. The
Expand All @@ -465,6 +471,7 @@ impl AtomicBool {
/// failure ordering can't be [`Release`] or [`AcqRel`] and must be equivalent or
/// weaker than the success ordering.
///
/// [`bool`]: ../../../std/primitive.bool.html
/// [`compare_exchange`]: #method.compare_exchange
/// [`Ordering`]: enum.Ordering.html
/// [`Release`]: enum.Ordering.html#variant.Release
Expand Down