Add `std::fmt::Pointer` implementation for `AtomicPtr`

Resolves #29212.
This commit is contained in:
varkor 2017-12-10 23:21:26 +00:00
parent 02b4d3ddfb
commit e4dc11d98d
1 changed files with 8 additions and 0 deletions

View File

@ -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)
}
}