Skip to content

Commit 5c21637

Browse files
committed
impl From<T> for AtomicT
1 parent 1fdcf52 commit 5c21637

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/libcore/sync/atomic.rs

+12
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,12 @@ impl<T> AtomicPtr<T> {
927927
}
928928
}
929929

930+
#[stable(feature = "rust1", since = "1.0.0")]
931+
impl<T> From<*mut T> for AtomicPtr<T> {
932+
#[inline]
933+
fn from(p: *mut T) -> Self { Self::new(p) }
934+
}
935+
930936
#[cfg(target_has_atomic = "ptr")]
931937
macro_rules! atomic_int {
932938
($stable:meta, $const_unstable:meta,
@@ -967,6 +973,12 @@ macro_rules! atomic_int {
967973
}
968974
}
969975

976+
#[$stable]
977+
impl From<$int_type> for $atomic_type {
978+
#[inline]
979+
fn from(v: $int_type) -> Self { Self::new(v) }
980+
}
981+
970982
#[$stable_debug]
971983
impl fmt::Debug for $atomic_type {
972984
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {

0 commit comments

Comments
 (0)