diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index 53b056d2b8b6f..76ef4b23bf71a 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -927,6 +927,12 @@ impl AtomicPtr { } } +#[stable(feature = "rust1", since = "1.0.0")] +impl From<*mut T> for AtomicPtr { + #[inline] + fn from(p: *mut T) -> Self { Self::new(p) } +} + #[cfg(target_has_atomic = "ptr")] macro_rules! atomic_int { ($stable:meta, $const_unstable:meta, @@ -967,6 +973,12 @@ macro_rules! atomic_int { } } + #[$stable] + 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 {