From 61fbdbba41163b6fd327b166338a8feb89133444 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 11 Jan 2017 23:12:49 +0100 Subject: [PATCH 1/4] Add Debug implementations for libcollection structs --- src/libcollections/binary_heap.rs | 60 +++++++++++++++ src/libcollections/btree/map.rs | 120 ++++++++++++++++++++++++++++++ src/libcollections/btree/set.rs | 108 +++++++++++++++++++++++++++ src/libcollections/enum_set.rs | 16 ++++ src/libcollections/lib.rs | 1 + src/libcollections/linked_list.rs | 80 ++++++++++++++++++++ src/libcollections/str.rs | 8 ++ src/libcollections/string.rs | 7 ++ src/libcollections/vec.rs | 32 ++++++++ src/libcollections/vec_deque.rs | 64 ++++++++++++++++ 10 files changed, 496 insertions(+) diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs index b7c2a708baf49..fca3b7b07dd2d 100644 --- a/src/libcollections/binary_heap.rs +++ b/src/libcollections/binary_heap.rs @@ -228,6 +228,20 @@ pub struct PeekMut<'a, T: 'a + Ord> { sift: bool, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: Ord> fmt::Debug for PeekMut<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("PeekMut { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: Ord + fmt::Debug> fmt::Debug for PeekMut<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad(&format!("PeekMut({:?})", self.heap.data[0])) + } +} + #[stable(feature = "binary_heap_peek_mut", since = "1.12.0")] impl<'a, T: Ord> Drop for PeekMut<'a, T> { fn drop(&mut self) { @@ -968,6 +982,22 @@ pub struct Iter<'a, T: 'a> { iter: slice::Iter<'a, T>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for Iter<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BinaryHeap::Iter { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("BinaryHeap::Iter") + .field(&self.iter.as_slice()) + .finish() + } +} + // FIXME(#19839) Remove in favor of `#[derive(Clone)]` #[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> Clone for Iter<'a, T> { @@ -1016,6 +1046,22 @@ pub struct IntoIter { iter: vec::IntoIter, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl fmt::Debug for IntoIter { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BinaryHeap::IntoIter { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl fmt::Debug for IntoIter { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("BinaryHeap::IntoIter") + .field(&self.iter.as_slice()) + .finish() + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl Iterator for IntoIter { type Item = T; @@ -1055,6 +1101,20 @@ pub struct Drain<'a, T: 'a> { iter: vec::Drain<'a, T>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for Drain<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BinaryHeap::Drain { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for Drain<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad(&format!("BinaryHeap::Drain({:?})", self.iter)) + } +} + #[stable(feature = "drain", since = "1.6.0")] impl<'a, T: 'a> Iterator for Drain<'a, T> { type Item = T; diff --git a/src/libcollections/btree/map.rs b/src/libcollections/btree/map.rs index 4755f8a4c55a4..0d8b9d4677bd4 100644 --- a/src/libcollections/btree/map.rs +++ b/src/libcollections/btree/map.rs @@ -270,6 +270,20 @@ pub struct Iter<'a, K: 'a, V: 'a> { length: usize, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, K: 'a, V: 'a> fmt::Debug for Iter<'a, K, V> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BTreeMap::Iter { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Iter<'a, K, V> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_list().entries(self.clone()).finish() + } +} + /// A mutable iterator over a BTreeMap's entries. #[stable(feature = "rust1", since = "1.0.0")] pub struct IterMut<'a, K: 'a, V: 'a> { @@ -277,6 +291,20 @@ pub struct IterMut<'a, K: 'a, V: 'a> { length: usize, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, K: 'a, V: 'a> fmt::Debug for IterMut<'a, K, V> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BTreeMap::IterMut { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for IterMut<'a, K, V> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad(&format!("BTreeMap::IterMut({:?})", self.range)) + } +} + /// An owning iterator over a BTreeMap's entries. #[stable(feature = "rust1", since = "1.0.0")] pub struct IntoIter { @@ -285,30 +313,104 @@ pub struct IntoIter { length: usize, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl fmt::Debug for IntoIter { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BTreeMap::IntoIter { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl fmt::Debug for IntoIter { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let range = Range { + front: self.front.reborrow(), + back: self.back.reborrow(), + }; + f.debug_list().entries(range).finish() + } +} + /// An iterator over a BTreeMap's keys. #[stable(feature = "rust1", since = "1.0.0")] pub struct Keys<'a, K: 'a, V: 'a> { inner: Iter<'a, K, V>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, K: 'a, V: 'a> fmt::Debug for Keys<'a, K, V> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BTreeMap::Keys { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Keys<'a, K, V> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_list().entries(self.inner.clone()).finish() + } +} + /// An iterator over a BTreeMap's values. #[stable(feature = "rust1", since = "1.0.0")] pub struct Values<'a, K: 'a, V: 'a> { inner: Iter<'a, K, V>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, K: 'a, V: 'a> fmt::Debug for Values<'a, K, V> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BTreeMap::Values { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Values<'a, K, V> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_list().entries(self.inner.clone()).finish() + } +} + /// A mutable iterator over a BTreeMap's values. #[stable(feature = "map_values_mut", since = "1.10.0")] pub struct ValuesMut<'a, K: 'a, V: 'a> { inner: IterMut<'a, K, V>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, K: 'a, V: 'a> fmt::Debug for ValuesMut<'a, K, V> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BTreeMap::ValuesMut { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for ValuesMut<'a, K, V> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad(&format!("BTreeMap::ValuesMut({:?})", self.inner)) + } +} + /// An iterator over a sub-range of BTreeMap's entries. pub struct Range<'a, K: 'a, V: 'a> { front: Handle, K, V, marker::Leaf>, marker::Edge>, back: Handle, K, V, marker::Leaf>, marker::Edge>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, K: 'a, V: 'a> fmt::Debug for Range<'a, K, V> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BTreeMap::Range { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Range<'a, K, V> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_list().entries(self.clone()).finish() + } +} + /// A mutable iterator over a sub-range of BTreeMap's entries. pub struct RangeMut<'a, K: 'a, V: 'a> { front: Handle, K, V, marker::Leaf>, marker::Edge>, @@ -318,6 +420,24 @@ pub struct RangeMut<'a, K: 'a, V: 'a> { _marker: PhantomData<&'a mut (K, V)>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, K: 'a, V: 'a> fmt::Debug for RangeMut<'a, K, V> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BTreeMap::RangeMut { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for RangeMut<'a, K, V> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let range = Range { + front: self.front.reborrow(), + back: self.back.reborrow(), + }; + f.debug_list().entries(range).finish() + } +} + /// A view into a single entry in a map, which may either be vacant or occupied. /// This enum is constructed from the [`entry`] method on [`BTreeMap`]. /// diff --git a/src/libcollections/btree/set.rs b/src/libcollections/btree/set.rs index f006ba9537161..d9effde72042b 100644 --- a/src/libcollections/btree/set.rs +++ b/src/libcollections/btree/set.rs @@ -85,6 +85,22 @@ pub struct Iter<'a, T: 'a> { iter: Keys<'a, T, ()>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for Iter<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BTreeSet::Iter { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("BTreeSet::Iter") + .field(&self.iter.clone()) + .finish() + } +} + /// An owning iterator over a `BTreeSet`'s items. /// /// This structure is created by the `into_iter` method on [`BTreeSet`] @@ -96,6 +112,20 @@ pub struct IntoIter { iter: ::btree_map::IntoIter, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl fmt::Debug for IntoIter { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BTreeSet::IntoIter { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl fmt::Debug for IntoIter { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad(&format!("BTreeSet::IntoIter({:?})", self.iter)) + } +} + /// An iterator over a sub-range of `BTreeSet`'s items. /// /// This structure is created by the [`range`] method on [`BTreeSet`]. @@ -106,6 +136,20 @@ pub struct Range<'a, T: 'a> { iter: ::btree_map::Range<'a, T, ()>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for Range<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BTreeSet::Range { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for Range<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad(&format!("BTreeSet::Range({:?})", self.iter)) + } +} + /// A lazy iterator producing elements in the set difference (in-order). /// /// This structure is created by the [`difference`] method on [`BTreeSet`]. @@ -118,6 +162,22 @@ pub struct Difference<'a, T: 'a> { b: Peekable>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for Difference<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BTreeSet::Difference { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for Difference<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("BTreeSet::Difference") + .field(&self.clone()) + .finish() + } +} + /// A lazy iterator producing elements in the set symmetric difference (in-order). /// /// This structure is created by the [`symmetric_difference`] method on @@ -131,6 +191,22 @@ pub struct SymmetricDifference<'a, T: 'a> { b: Peekable>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for SymmetricDifference<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BTreeSet::SymmetricDifference { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for SymmetricDifference<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("BTreeSet::SymmetricDifference") + .field(&self.clone()) + .finish() + } +} + /// A lazy iterator producing elements in the set intersection (in-order). /// /// This structure is created by the [`intersection`] method on [`BTreeSet`]. @@ -143,6 +219,22 @@ pub struct Intersection<'a, T: 'a> { b: Peekable>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for Intersection<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BTreeSet::Intersection { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for Intersection<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("BTreeSet::Intersection") + .field(&self.clone()) + .finish() + } +} + /// A lazy iterator producing elements in the set union (in-order). /// /// This structure is created by the [`union`] method on [`BTreeSet`]. @@ -155,6 +247,22 @@ pub struct Union<'a, T: 'a> { b: Peekable>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for Union<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BTreeSet::Union { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for Union<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("BTreeSet::Union") + .field(&self.clone()) + .finish() + } +} + impl BTreeSet { /// Makes a new `BTreeSet` with a reasonable choice of B. /// diff --git a/src/libcollections/enum_set.rs b/src/libcollections/enum_set.rs index 87bc5e59ef78c..3e739fa4f957b 100644 --- a/src/libcollections/enum_set.rs +++ b/src/libcollections/enum_set.rs @@ -220,6 +220,22 @@ pub struct Iter { marker: marker::PhantomData, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl fmt::Debug for Iter { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("EnumSet::Iter { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl fmt::Debug for Iter { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("EnumSet::Iter") + .field(&self.clone()) + .finish() + } +} + // FIXME(#19839) Remove in favor of `#[derive(Clone)]` impl Clone for Iter { fn clone(&self) -> Iter { diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index 561d8860dc880..92d0d4d3c5493 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -28,6 +28,7 @@ #![cfg_attr(test, allow(deprecated))] // rand #![deny(warnings)] +#![deny(missing_debug_implementations)] #![feature(alloc)] #![feature(allow_internal_unstable)] diff --git a/src/libcollections/linked_list.rs b/src/libcollections/linked_list.rs index 7f913d4afe476..112749d5b0588 100644 --- a/src/libcollections/linked_list.rs +++ b/src/libcollections/linked_list.rs @@ -65,6 +65,22 @@ pub struct Iter<'a, T: 'a> { marker: PhantomData<&'a Node>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for Iter<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("LinkedList::Iter { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("LinkedList::Iter") + .field(&self.clone()) + .finish() + } +} + // FIXME #19839: deriving is too aggressive on the bounds (T doesn't need to be Clone). #[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> Clone for Iter<'a, T> { @@ -82,6 +98,22 @@ pub struct IterMut<'a, T: 'a> { len: usize, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for IterMut<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("LinkedList::IterMut { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for IterMut<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("LinkedList::IterMut") + .field(self.clone()) + .finish() + } +} + /// An iterator over the elements of a `LinkedList`. #[derive(Clone)] #[stable(feature = "rust1", since = "1.0.0")] @@ -89,6 +121,22 @@ pub struct IntoIter { list: LinkedList, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl fmt::Debug for IntoIter { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("LinkedList::IntoIter { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl fmt::Debug for IntoIter { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("LinkedList::IntoIter") + .field(self.clone()) + .finish() + } +} + impl Node { fn new(element: T) -> Self { Node { @@ -1077,6 +1125,22 @@ pub struct FrontPlace<'a, T: 'a> { node: IntermediateBox>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for FrontPlace<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("LinkedList::FrontPlace { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for FrontPlace<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("LinkedList::FrontPlace") + .field(self.clone()) + .finish() + } +} + #[unstable(feature = "collection_placement", reason = "placement protocol is subject to change", issue = "30172")] @@ -1121,6 +1185,22 @@ pub struct BackPlace<'a, T: 'a> { node: IntermediateBox>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for BackPlace<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("LinkedList::BackPlace { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for BackPlace<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("LinkedList::BackPlace") + .field(self.clone()) + .finish() + } +} + #[unstable(feature = "collection_placement", reason = "placement protocol is subject to change", issue = "30172")] diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 70cedce9a905e..8dbddbb41d7bc 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -19,6 +19,7 @@ // It's cleaner to just turn off the unused_imports warning than to fix them. #![allow(unused_imports)] +use core::fmt; use core::str as core_str; use core::str::pattern::Pattern; use core::str::pattern::{Searcher, ReverseSearcher, DoubleEndedSearcher}; @@ -122,6 +123,13 @@ pub struct EncodeUtf16<'a> { encoder: Utf16Encoder>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a> fmt::Debug for EncodeUtf16<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("EncodeUtf16 { .. }") + } +} + #[stable(feature = "encode_utf16", since = "1.8.0")] impl<'a> Iterator for EncodeUtf16<'a> { type Item = u16; diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index 5210c25b4e5c8..1a9849f2352a3 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -1979,6 +1979,13 @@ pub struct Drain<'a> { iter: Chars<'a>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a> fmt::Debug for Drain<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("String::Drain { .. }") + } +} + #[stable(feature = "drain", since = "1.6.0")] unsafe impl<'a> Sync for Drain<'a> {} #[stable(feature = "drain", since = "1.6.0")] diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 4b05f8062e8bc..4f6212a1709a0 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -2092,6 +2092,22 @@ pub struct Drain<'a, T: 'a> { vec: Shared>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for Drain<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("Vec::Drain { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for Drain<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("Vec::Drain") + .field(&self.iter.as_slice()) + .finish() + } +} + #[stable(feature = "drain", since = "1.6.0")] unsafe impl<'a, T: Sync> Sync for Drain<'a, T> {} #[stable(feature = "drain", since = "1.6.0")] @@ -2162,6 +2178,22 @@ pub struct PlaceBack<'a, T: 'a> { vec: &'a mut Vec, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for PlaceBack<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("Vec::PlaceBack { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for PlaceBack<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("Vec::PlaceBack") + .field(&self.vec.as_slice()) + .finish() + } +} + #[unstable(feature = "collection_placement", reason = "placement protocol is subject to change", issue = "30172")] diff --git a/src/libcollections/vec_deque.rs b/src/libcollections/vec_deque.rs index fea2d111f472e..dfbfb240f4602 100644 --- a/src/libcollections/vec_deque.rs +++ b/src/libcollections/vec_deque.rs @@ -1866,6 +1866,22 @@ pub struct Iter<'a, T: 'a> { head: usize, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for Iter<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("VecDeque::Iter { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("VecDeque::Iter") + .field(&self.clone()) + .finish() + } +} + // FIXME(#19839) Remove in favor of `#[derive(Clone)]` #[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> Clone for Iter<'a, T> { @@ -1938,6 +1954,22 @@ pub struct IterMut<'a, T: 'a> { head: usize, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for IterMut<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("VecDeque::IterMut { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for IterMut<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("VecDeque::IterMut") + .field(&self.clone()) + .finish() + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> Iterator for IterMut<'a, T> { type Item = &'a mut T; @@ -2004,6 +2036,22 @@ pub struct IntoIter { inner: VecDeque, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl fmt::Debug for IntoIter { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("VecDeque::IntoIter { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl fmt::Debug for IntoIter { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("VecDeque::IntoIter") + .field(&self.clone()) + .finish() + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl Iterator for IntoIter { type Item = T; @@ -2047,6 +2095,22 @@ pub struct Drain<'a, T: 'a> { deque: Shared>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for Drain<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("VecDeque::Drain { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for Drain<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("VecDeque::Drain") + .field(&self.clone()) + .finish() + } +} + #[stable(feature = "drain", since = "1.6.0")] unsafe impl<'a, T: Sync> Sync for Drain<'a, T> {} #[stable(feature = "drain", since = "1.6.0")] From ba841f056e888549ef0bec0f79262ae65444d0fd Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 20 Jan 2017 13:05:02 +0100 Subject: [PATCH 2/4] Remove Debug implementations specialization --- src/libcollections/binary_heap.rs | 36 ++++---------------- src/libcollections/btree/map.rs | 56 ------------------------------- src/libcollections/btree/set.rs | 49 --------------------------- src/libcollections/enum_set.rs | 7 ---- src/libcollections/linked_list.rs | 35 ------------------- src/libcollections/vec.rs | 14 -------- src/libcollections/vec_deque.rs | 28 ---------------- 7 files changed, 6 insertions(+), 219 deletions(-) diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs index fca3b7b07dd2d..93b864a007fcb 100644 --- a/src/libcollections/binary_heap.rs +++ b/src/libcollections/binary_heap.rs @@ -228,17 +228,12 @@ pub struct PeekMut<'a, T: 'a + Ord> { sift: bool, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: Ord> fmt::Debug for PeekMut<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("PeekMut { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: Ord + fmt::Debug> fmt::Debug for PeekMut<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad(&format!("PeekMut({:?})", self.heap.data[0])) + f.debug_tuple("PeekMut") + .field(&self.heap.data[0]) + .finish() } } @@ -982,13 +977,6 @@ pub struct Iter<'a, T: 'a> { iter: slice::Iter<'a, T>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for Iter<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BinaryHeap::Iter { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -1046,13 +1034,6 @@ pub struct IntoIter { iter: vec::IntoIter, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl fmt::Debug for IntoIter { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BinaryHeap::IntoIter { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl fmt::Debug for IntoIter { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -1101,17 +1082,12 @@ pub struct Drain<'a, T: 'a> { iter: vec::Drain<'a, T>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for Drain<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BinaryHeap::Drain { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Drain<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad(&format!("BinaryHeap::Drain({:?})", self.iter)) + f.debug_tuple("BinaryHeap::Drain") + .field(&self.iter) + .finish() } } diff --git a/src/libcollections/btree/map.rs b/src/libcollections/btree/map.rs index 0d8b9d4677bd4..eb6a8ea26a3ba 100644 --- a/src/libcollections/btree/map.rs +++ b/src/libcollections/btree/map.rs @@ -270,13 +270,6 @@ pub struct Iter<'a, K: 'a, V: 'a> { length: usize, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, K: 'a, V: 'a> fmt::Debug for Iter<'a, K, V> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BTreeMap::Iter { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Iter<'a, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -291,13 +284,6 @@ pub struct IterMut<'a, K: 'a, V: 'a> { length: usize, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, K: 'a, V: 'a> fmt::Debug for IterMut<'a, K, V> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BTreeMap::IterMut { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for IterMut<'a, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -313,13 +299,6 @@ pub struct IntoIter { length: usize, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl fmt::Debug for IntoIter { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BTreeMap::IntoIter { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl fmt::Debug for IntoIter { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -337,13 +316,6 @@ pub struct Keys<'a, K: 'a, V: 'a> { inner: Iter<'a, K, V>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, K: 'a, V: 'a> fmt::Debug for Keys<'a, K, V> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BTreeMap::Keys { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Keys<'a, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -357,13 +329,6 @@ pub struct Values<'a, K: 'a, V: 'a> { inner: Iter<'a, K, V>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, K: 'a, V: 'a> fmt::Debug for Values<'a, K, V> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BTreeMap::Values { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Values<'a, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -377,13 +342,6 @@ pub struct ValuesMut<'a, K: 'a, V: 'a> { inner: IterMut<'a, K, V>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, K: 'a, V: 'a> fmt::Debug for ValuesMut<'a, K, V> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BTreeMap::ValuesMut { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for ValuesMut<'a, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -397,13 +355,6 @@ pub struct Range<'a, K: 'a, V: 'a> { back: Handle, K, V, marker::Leaf>, marker::Edge>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, K: 'a, V: 'a> fmt::Debug for Range<'a, K, V> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BTreeMap::Range { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Range<'a, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -420,13 +371,6 @@ pub struct RangeMut<'a, K: 'a, V: 'a> { _marker: PhantomData<&'a mut (K, V)>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, K: 'a, V: 'a> fmt::Debug for RangeMut<'a, K, V> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BTreeMap::RangeMut { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for RangeMut<'a, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { diff --git a/src/libcollections/btree/set.rs b/src/libcollections/btree/set.rs index d9effde72042b..f90d0df768b9f 100644 --- a/src/libcollections/btree/set.rs +++ b/src/libcollections/btree/set.rs @@ -85,13 +85,6 @@ pub struct Iter<'a, T: 'a> { iter: Keys<'a, T, ()>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for Iter<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BTreeSet::Iter { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -112,13 +105,6 @@ pub struct IntoIter { iter: ::btree_map::IntoIter, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl fmt::Debug for IntoIter { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BTreeSet::IntoIter { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl fmt::Debug for IntoIter { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -136,13 +122,6 @@ pub struct Range<'a, T: 'a> { iter: ::btree_map::Range<'a, T, ()>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for Range<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BTreeSet::Range { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Range<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -162,13 +141,6 @@ pub struct Difference<'a, T: 'a> { b: Peekable>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for Difference<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BTreeSet::Difference { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Difference<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -191,13 +163,6 @@ pub struct SymmetricDifference<'a, T: 'a> { b: Peekable>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for SymmetricDifference<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BTreeSet::SymmetricDifference { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for SymmetricDifference<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -219,13 +184,6 @@ pub struct Intersection<'a, T: 'a> { b: Peekable>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for Intersection<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BTreeSet::Intersection { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Intersection<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -247,13 +205,6 @@ pub struct Union<'a, T: 'a> { b: Peekable>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for Union<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BTreeSet::Union { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Union<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { diff --git a/src/libcollections/enum_set.rs b/src/libcollections/enum_set.rs index 3e739fa4f957b..e4498c1761709 100644 --- a/src/libcollections/enum_set.rs +++ b/src/libcollections/enum_set.rs @@ -220,13 +220,6 @@ pub struct Iter { marker: marker::PhantomData, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl fmt::Debug for Iter { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("EnumSet::Iter { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl fmt::Debug for Iter { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { diff --git a/src/libcollections/linked_list.rs b/src/libcollections/linked_list.rs index 112749d5b0588..21be9ac1aab87 100644 --- a/src/libcollections/linked_list.rs +++ b/src/libcollections/linked_list.rs @@ -65,13 +65,6 @@ pub struct Iter<'a, T: 'a> { marker: PhantomData<&'a Node>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for Iter<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("LinkedList::Iter { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -98,13 +91,6 @@ pub struct IterMut<'a, T: 'a> { len: usize, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for IterMut<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("LinkedList::IterMut { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for IterMut<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -121,13 +107,6 @@ pub struct IntoIter { list: LinkedList, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl fmt::Debug for IntoIter { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("LinkedList::IntoIter { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl fmt::Debug for IntoIter { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -1125,13 +1104,6 @@ pub struct FrontPlace<'a, T: 'a> { node: IntermediateBox>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for FrontPlace<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("LinkedList::FrontPlace { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for FrontPlace<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -1185,13 +1157,6 @@ pub struct BackPlace<'a, T: 'a> { node: IntermediateBox>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for BackPlace<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("LinkedList::BackPlace { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for BackPlace<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 4f6212a1709a0..2b6343782b199 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -2092,13 +2092,6 @@ pub struct Drain<'a, T: 'a> { vec: Shared>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for Drain<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("Vec::Drain { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Drain<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -2178,13 +2171,6 @@ pub struct PlaceBack<'a, T: 'a> { vec: &'a mut Vec, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for PlaceBack<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("Vec::PlaceBack { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for PlaceBack<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { diff --git a/src/libcollections/vec_deque.rs b/src/libcollections/vec_deque.rs index dfbfb240f4602..11aacb0ff43d1 100644 --- a/src/libcollections/vec_deque.rs +++ b/src/libcollections/vec_deque.rs @@ -1866,13 +1866,6 @@ pub struct Iter<'a, T: 'a> { head: usize, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for Iter<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("VecDeque::Iter { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -1954,13 +1947,6 @@ pub struct IterMut<'a, T: 'a> { head: usize, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for IterMut<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("VecDeque::IterMut { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for IterMut<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -2036,13 +2022,6 @@ pub struct IntoIter { inner: VecDeque, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl fmt::Debug for IntoIter { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("VecDeque::IntoIter { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl fmt::Debug for IntoIter { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -2095,13 +2074,6 @@ pub struct Drain<'a, T: 'a> { deque: Shared>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for Drain<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("VecDeque::Drain { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Drain<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { From 668af801cfe80e6cae350b2587f99bbe869ec96e Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 20 Jan 2017 21:51:01 +0100 Subject: [PATCH 3/4] Add debug implementation for BinaryHeapPlace --- src/libcollections/binary_heap.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs index 93b864a007fcb..b9d90c358fe21 100644 --- a/src/libcollections/binary_heap.rs +++ b/src/libcollections/binary_heap.rs @@ -1236,6 +1236,15 @@ where T: Clone + Ord { place: vec::PlaceBack<'a, T>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: Clone + Ord + fmt::Debug> fmt::Debug for BinaryHeapPlace<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("BinaryHeapPlace") + .field(&self) + .finish() + } +} + #[unstable(feature = "collection_placement", reason = "placement protocol is subject to change", issue = "30172")] From 0cc2448e053047546aff4ea0749adb06896092b5 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 21 Jan 2017 00:33:38 +0100 Subject: [PATCH 4/4] Replace PlaceBack Debug implementation with derive --- src/libcollections/binary_heap.rs | 26 +++++++++------------- src/libcollections/btree/map.rs | 28 +++++++----------------- src/libcollections/btree/set.rs | 36 +++++++++++-------------------- src/libcollections/enum_set.rs | 3 +-- src/libcollections/linked_list.rs | 24 ++++++++++++--------- src/libcollections/str.rs | 2 +- src/libcollections/string.rs | 4 ++-- src/libcollections/vec.rs | 14 +++--------- src/libcollections/vec_deque.rs | 16 +++++++------- 9 files changed, 59 insertions(+), 94 deletions(-) diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs index b9d90c358fe21..fa1c2b7d2aaf9 100644 --- a/src/libcollections/binary_heap.rs +++ b/src/libcollections/binary_heap.rs @@ -228,7 +228,7 @@ pub struct PeekMut<'a, T: 'a + Ord> { sift: bool, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, T: Ord + fmt::Debug> fmt::Debug for PeekMut<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_tuple("PeekMut") @@ -977,10 +977,10 @@ pub struct Iter<'a, T: 'a> { iter: slice::Iter<'a, T>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("BinaryHeap::Iter") + f.debug_tuple("Iter") .field(&self.iter.as_slice()) .finish() } @@ -1034,10 +1034,10 @@ pub struct IntoIter { iter: vec::IntoIter, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl fmt::Debug for IntoIter { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("BinaryHeap::IntoIter") + f.debug_tuple("IntoIter") .field(&self.iter.as_slice()) .finish() } @@ -1078,19 +1078,11 @@ impl FusedIterator for IntoIter {} /// An iterator that drains a `BinaryHeap`. #[stable(feature = "drain", since = "1.6.0")] +#[derive(Debug)] pub struct Drain<'a, T: 'a> { iter: vec::Drain<'a, T>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a + fmt::Debug> fmt::Debug for Drain<'a, T> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("BinaryHeap::Drain") - .field(&self.iter) - .finish() - } -} - #[stable(feature = "drain", since = "1.6.0")] impl<'a, T: 'a> Iterator for Drain<'a, T> { type Item = T; @@ -1236,11 +1228,13 @@ where T: Clone + Ord { place: vec::PlaceBack<'a, T>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[unstable(feature = "collection_placement", + reason = "placement protocol is subject to change", + issue = "30172")] impl<'a, T: Clone + Ord + fmt::Debug> fmt::Debug for BinaryHeapPlace<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_tuple("BinaryHeapPlace") - .field(&self) + .field(&self.place) .finish() } } diff --git a/src/libcollections/btree/map.rs b/src/libcollections/btree/map.rs index eb6a8ea26a3ba..e1fabe2cc496b 100644 --- a/src/libcollections/btree/map.rs +++ b/src/libcollections/btree/map.rs @@ -270,7 +270,7 @@ pub struct Iter<'a, K: 'a, V: 'a> { length: usize, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Iter<'a, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_list().entries(self.clone()).finish() @@ -279,18 +279,12 @@ impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Iter<'a, K, V> { /// A mutable iterator over a BTreeMap's entries. #[stable(feature = "rust1", since = "1.0.0")] +#[derive(Debug)] pub struct IterMut<'a, K: 'a, V: 'a> { range: RangeMut<'a, K, V>, length: usize, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for IterMut<'a, K, V> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad(&format!("BTreeMap::IterMut({:?})", self.range)) - } -} - /// An owning iterator over a BTreeMap's entries. #[stable(feature = "rust1", since = "1.0.0")] pub struct IntoIter { @@ -299,7 +293,7 @@ pub struct IntoIter { length: usize, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl fmt::Debug for IntoIter { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let range = Range { @@ -316,7 +310,7 @@ pub struct Keys<'a, K: 'a, V: 'a> { inner: Iter<'a, K, V>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Keys<'a, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_list().entries(self.inner.clone()).finish() @@ -329,7 +323,7 @@ pub struct Values<'a, K: 'a, V: 'a> { inner: Iter<'a, K, V>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Values<'a, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_list().entries(self.inner.clone()).finish() @@ -338,24 +332,18 @@ impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Values<'a, K, V> /// A mutable iterator over a BTreeMap's values. #[stable(feature = "map_values_mut", since = "1.10.0")] +#[derive(Debug)] pub struct ValuesMut<'a, K: 'a, V: 'a> { inner: IterMut<'a, K, V>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for ValuesMut<'a, K, V> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad(&format!("BTreeMap::ValuesMut({:?})", self.inner)) - } -} - /// An iterator over a sub-range of BTreeMap's entries. pub struct Range<'a, K: 'a, V: 'a> { front: Handle, K, V, marker::Leaf>, marker::Edge>, back: Handle, K, V, marker::Leaf>, marker::Edge>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Range<'a, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_list().entries(self.clone()).finish() @@ -371,7 +359,7 @@ pub struct RangeMut<'a, K: 'a, V: 'a> { _marker: PhantomData<&'a mut (K, V)>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for RangeMut<'a, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let range = Range { diff --git a/src/libcollections/btree/set.rs b/src/libcollections/btree/set.rs index f90d0df768b9f..bfffa0b8efa1c 100644 --- a/src/libcollections/btree/set.rs +++ b/src/libcollections/btree/set.rs @@ -85,10 +85,10 @@ pub struct Iter<'a, T: 'a> { iter: Keys<'a, T, ()>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("BTreeSet::Iter") + f.debug_tuple("Iter") .field(&self.iter.clone()) .finish() } @@ -101,34 +101,22 @@ impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { /// /// [`BTreeSet`]: struct.BTreeSet.html #[stable(feature = "rust1", since = "1.0.0")] +#[derive(Debug)] pub struct IntoIter { iter: ::btree_map::IntoIter, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl fmt::Debug for IntoIter { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad(&format!("BTreeSet::IntoIter({:?})", self.iter)) - } -} - /// An iterator over a sub-range of `BTreeSet`'s items. /// /// This structure is created by the [`range`] method on [`BTreeSet`]. /// /// [`BTreeSet`]: struct.BTreeSet.html /// [`range`]: struct.BTreeSet.html#method.range +#[derive(Debug)] pub struct Range<'a, T: 'a> { iter: ::btree_map::Range<'a, T, ()>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a + fmt::Debug> fmt::Debug for Range<'a, T> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad(&format!("BTreeSet::Range({:?})", self.iter)) - } -} - /// A lazy iterator producing elements in the set difference (in-order). /// /// This structure is created by the [`difference`] method on [`BTreeSet`]. @@ -141,10 +129,10 @@ pub struct Difference<'a, T: 'a> { b: Peekable>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Difference<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("BTreeSet::Difference") + f.debug_tuple("Difference") .field(&self.clone()) .finish() } @@ -163,10 +151,10 @@ pub struct SymmetricDifference<'a, T: 'a> { b: Peekable>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for SymmetricDifference<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("BTreeSet::SymmetricDifference") + f.debug_tuple("SymmetricDifference") .field(&self.clone()) .finish() } @@ -184,10 +172,10 @@ pub struct Intersection<'a, T: 'a> { b: Peekable>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Intersection<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("BTreeSet::Intersection") + f.debug_tuple("Intersection") .field(&self.clone()) .finish() } @@ -205,10 +193,10 @@ pub struct Union<'a, T: 'a> { b: Peekable>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Union<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("BTreeSet::Union") + f.debug_tuple("Union") .field(&self.clone()) .finish() } diff --git a/src/libcollections/enum_set.rs b/src/libcollections/enum_set.rs index e4498c1761709..9bbb10136437c 100644 --- a/src/libcollections/enum_set.rs +++ b/src/libcollections/enum_set.rs @@ -220,10 +220,9 @@ pub struct Iter { marker: marker::PhantomData, } -#[stable(feature = "collection_debug", since = "1.15.0")] impl fmt::Debug for Iter { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("EnumSet::Iter") + f.debug_tuple("Iter") .field(&self.clone()) .finish() } diff --git a/src/libcollections/linked_list.rs b/src/libcollections/linked_list.rs index 21be9ac1aab87..d4f77d625b361 100644 --- a/src/libcollections/linked_list.rs +++ b/src/libcollections/linked_list.rs @@ -65,10 +65,10 @@ pub struct Iter<'a, T: 'a> { marker: PhantomData<&'a Node>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("LinkedList::Iter") + f.debug_tuple("Iter") .field(&self.clone()) .finish() } @@ -91,10 +91,10 @@ pub struct IterMut<'a, T: 'a> { len: usize, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for IterMut<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("LinkedList::IterMut") + f.debug_tuple("IterMut") .field(self.clone()) .finish() } @@ -107,10 +107,10 @@ pub struct IntoIter { list: LinkedList, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl fmt::Debug for IntoIter { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("LinkedList::IntoIter") + f.debug_tuple("IntoIter") .field(self.clone()) .finish() } @@ -1104,10 +1104,12 @@ pub struct FrontPlace<'a, T: 'a> { node: IntermediateBox>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[unstable(feature = "collection_placement", + reason = "struct name and placement protocol are subject to change", + issue = "30172")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for FrontPlace<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("LinkedList::FrontPlace") + f.debug_tuple("FrontPlace") .field(self.clone()) .finish() } @@ -1157,10 +1159,12 @@ pub struct BackPlace<'a, T: 'a> { node: IntermediateBox>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[unstable(feature = "collection_placement", + reason = "struct name and placement protocol are subject to change", + issue = "30172")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for BackPlace<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("LinkedList::BackPlace") + f.debug_tuple("BackPlace") .field(self.clone()) .finish() } diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 8dbddbb41d7bc..da5e8d03ea83e 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -123,7 +123,7 @@ pub struct EncodeUtf16<'a> { encoder: Utf16Encoder>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a> fmt::Debug for EncodeUtf16<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.pad("EncodeUtf16 { .. }") diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index 1a9849f2352a3..15a533d6d87cb 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -1979,10 +1979,10 @@ pub struct Drain<'a> { iter: Chars<'a>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a> fmt::Debug for Drain<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("String::Drain { .. }") + f.pad("Drain { .. }") } } diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 2b6343782b199..97ce404a11f71 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -2092,10 +2092,10 @@ pub struct Drain<'a, T: 'a> { vec: Shared>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Drain<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("Vec::Drain") + f.debug_tuple("Drain") .field(&self.iter.as_slice()) .finish() } @@ -2167,19 +2167,11 @@ impl<'a, T> FusedIterator for Drain<'a, T> {} #[unstable(feature = "collection_placement", reason = "struct name and placement protocol are subject to change", issue = "30172")] +#[derive(Debug)] pub struct PlaceBack<'a, T: 'a> { vec: &'a mut Vec, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a + fmt::Debug> fmt::Debug for PlaceBack<'a, T> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("Vec::PlaceBack") - .field(&self.vec.as_slice()) - .finish() - } -} - #[unstable(feature = "collection_placement", reason = "placement protocol is subject to change", issue = "30172")] diff --git a/src/libcollections/vec_deque.rs b/src/libcollections/vec_deque.rs index 11aacb0ff43d1..a88a70888c50c 100644 --- a/src/libcollections/vec_deque.rs +++ b/src/libcollections/vec_deque.rs @@ -1866,10 +1866,10 @@ pub struct Iter<'a, T: 'a> { head: usize, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("VecDeque::Iter") + f.debug_tuple("Iter") .field(&self.clone()) .finish() } @@ -1947,10 +1947,10 @@ pub struct IterMut<'a, T: 'a> { head: usize, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for IterMut<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("VecDeque::IterMut") + f.debug_tuple("IterMut") .field(&self.clone()) .finish() } @@ -2022,10 +2022,10 @@ pub struct IntoIter { inner: VecDeque, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl fmt::Debug for IntoIter { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("VecDeque::IntoIter") + f.debug_tuple("IntoIter") .field(&self.clone()) .finish() } @@ -2074,10 +2074,10 @@ pub struct Drain<'a, T: 'a> { deque: Shared>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Drain<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("VecDeque::Drain") + f.debug_tuple("Drain") .field(&self.clone()) .finish() }