about summary refs log tree commit diff
path: root/src/libcore/sync
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2017-12-10 23:21:26 +0000
committervarkor <github@varkor.com>2017-12-10 23:21:26 +0000
commite4dc11d98d6e7d9fb42ce847ee6b6194e764d1b7 (patch)
tree7a96d4669671102f951d52e8e556a1a295e861e4 /src/libcore/sync
parent02b4d3ddfb7cd9f1caf8ed90f18f8e798a1f4b05 (diff)
Add `std::fmt::Pointer` implementation for `AtomicPtr`
Resolves #29212.
Diffstat (limited to 'src/libcore/sync')
-rw-r--r--src/libcore/sync/atomic.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs
index 4c6ff4d1bb4..e334d2014af 100644
--- a/src/libcore/sync/atomic.rs
+++ b/src/libcore/sync/atomic.rs
@@ -1819,3 +1819,11 @@ impl<T> fmt::Debug for AtomicPtr<T> {
         f.debug_tuple("AtomicPtr").field(&self.load(Ordering::SeqCst)).finish()
     }
 }
+
+#[cfg(target_has_atomic = "ptr")]
+#[stable(feature = "atomic_pointer", since = "1.24.0")]
+impl<T> fmt::Pointer for AtomicPtr<T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        fmt::Pointer::fmt(&self.load(Ordering::SeqCst), f)
+    }
+}