We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 9ca6ee0 + be21779 commit ae512c4Copy full SHA for ae512c4
src/libcore/sync/atomic.rs
@@ -927,6 +927,12 @@ impl<T> AtomicPtr<T> {
927
}
928
929
930
+#[stable(feature = "atomic_from", since = "1.23.0")]
931
+impl<T> From<*mut T> for AtomicPtr<T> {
932
+ #[inline]
933
+ fn from(p: *mut T) -> Self { Self::new(p) }
934
+}
935
+
936
#[cfg(target_has_atomic = "ptr")]
937
macro_rules! atomic_int {
938
($stable:meta, $const_unstable:meta,
@@ -967,6 +973,12 @@ macro_rules! atomic_int {
967
973
968
974
969
975
976
+ #[stable(feature = "atomic_from", since = "1.23.0")]
977
+ impl From<$int_type> for $atomic_type {
978
979
+ fn from(v: $int_type) -> Self { Self::new(v) }
980
+ }
981
970
982
#[$stable_debug]
971
983
impl fmt::Debug for $atomic_type {
972
984
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
0 commit comments