Skip to content

Commit

Permalink
Rollup merge of rust-lang#45610 - strake:atomic_from, r=nagisa
Browse files Browse the repository at this point in the history
impl From<T> for AtomicT
  • Loading branch information
kennytm authored Nov 4, 2017
2 parents 9ca6ee0 + be21779 commit ae512c4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/libcore/sync/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,12 @@ impl<T> AtomicPtr<T> {
}
}

#[stable(feature = "atomic_from", since = "1.23.0")]
impl<T> From<*mut T> for AtomicPtr<T> {
#[inline]
fn from(p: *mut T) -> Self { Self::new(p) }
}

#[cfg(target_has_atomic = "ptr")]
macro_rules! atomic_int {
($stable:meta, $const_unstable:meta,
Expand Down Expand Up @@ -967,6 +973,12 @@ macro_rules! atomic_int {
}
}

#[stable(feature = "atomic_from", since = "1.23.0")]
impl From<$int_type> for $atomic_type {
#[inline]
fn from(v: $int_type) -> Self { Self::new(v) }
}

#[$stable_debug]
impl fmt::Debug for $atomic_type {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
Expand Down

0 comments on commit ae512c4

Please sign in to comment.