Skip to content

Commit

Permalink
Auto merge of rust-lang#46647 - varkor:contrib-1, r=sfackler
Browse files Browse the repository at this point in the history
Add `std::fmt::Pointer` implementation for `AtomicPtr`

Resolves rust-lang#29212.
  • Loading branch information
bors committed Dec 12, 2017
2 parents 4c2819d + e4dc11d commit 707d070
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/libcore/sync/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

0 comments on commit 707d070

Please sign in to comment.