Skip to content

Commit

Permalink
Rollup merge of rust-lang#53506 - phungleson:fix-from-docs-atomic, r=…
Browse files Browse the repository at this point in the history
…KodrAus

Documentation for impl From for AtomicBool and other Atomic types

As part of issue rust-lang#51430 (cc @skade).

The impl is very simple, so not sure if we need to go into any details.
  • Loading branch information
Centril authored Dec 16, 2018
2 parents 748d354 + 94c1c73 commit 443881a
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/libcore/sync/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,15 @@ impl<T> AtomicPtr<T> {
#[cfg(target_has_atomic = "8")]
#[stable(feature = "atomic_bool_from", since = "1.24.0")]
impl From<bool> for AtomicBool {
/// Converts a `bool` into an `AtomicBool`.
///
/// # Examples
///
/// ```
/// use std::sync::atomic::AtomicBool;
/// let atomic_bool = AtomicBool::from(true);
/// assert_eq!(format!("{:?}", atomic_bool), "true")
/// ```
#[inline]
fn from(b: bool) -> Self { Self::new(b) }
}
Expand Down Expand Up @@ -1126,8 +1135,12 @@ macro_rules! atomic_int {

#[$stable_from]
impl From<$int_type> for $atomic_type {
#[inline]
fn from(v: $int_type) -> Self { Self::new(v) }
doc_comment! {
concat!(
"Converts an `", stringify!($int_type), "` into an `", stringify!($atomic_type), "`."),
#[inline]
fn from(v: $int_type) -> Self { Self::new(v) }
}
}

#[$stable_debug]
Expand Down

0 comments on commit 443881a

Please sign in to comment.