about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-09-02 06:37:32 +0000
committerbors <bors@rust-lang.org>2015-09-02 06:37:32 +0000
commit0dbbab904916236d59446b9f51944a057e7b9966 (patch)
treec22d5bbcbc6971259286efa9ba80dcfc26e8da23
parentcb40b8a2ab562f103c86a2f5ac8ac66084d2754e (diff)
parent8db906c752bb1f3b69499acc7a44576611c123c6 (diff)
downloadrust-0dbbab904916236d59446b9f51944a057e7b9966.tar.gz
rust-0dbbab904916236d59446b9f51944a057e7b9966.zip
Auto merge of #28156 - nagisa:binaryheap-debug, r=Gankro
r? @Gankro 
-rw-r--r--src/libcollections/binary_heap.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs
index 3ca69736126..a3e32b59b71 100644
--- a/src/libcollections/binary_heap.rs
+++ b/src/libcollections/binary_heap.rs
@@ -154,6 +154,7 @@
 use core::iter::{FromIterator};
 use core::mem::swap;
 use core::ptr;
+use core::fmt;
 
 use slice;
 use vec::{self, Vec};
@@ -178,6 +179,13 @@ impl<T: Ord> Default for BinaryHeap<T> {
     fn default() -> BinaryHeap<T> { BinaryHeap::new() }
 }
 
+#[stable(feature = "binaryheap_debug", since = "1.4.0")]
+impl<T: fmt::Debug + Ord> fmt::Debug for BinaryHeap<T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.debug_list().entries(self.iter()).finish()
+    }
+}
+
 impl<T: Ord> BinaryHeap<T> {
     /// Creates an empty `BinaryHeap` as a max-heap.
     ///