diff options
| author | MaloJaffre <jaffre.malo@gmail.com> | 2018-08-21 19:50:05 +0200 |
|---|---|---|
| committer | MaloJaffre <jaffre.malo@gmail.com> | 2018-08-22 13:15:50 +0200 |
| commit | b85e4cc8fadaabd41da5b9645c08c68b8f89908d (patch) | |
| tree | a6a605e7b0695ff0569e848dafc9fd0196ffc336 /src/liballoc | |
| parent | 241b9b45c0580ee3359b1f8139995b95c644eeac (diff) | |
| download | rust-b85e4cc8fadaabd41da5b9645c08c68b8f89908d.tar.gz rust-b85e4cc8fadaabd41da5b9645c08c68b8f89908d.zip | |
Fix unsoundness in VecDeque Debug impls
Fixes #53566.
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/collections/vec_deque.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/liballoc/collections/vec_deque.rs b/src/liballoc/collections/vec_deque.rs index cbc80b70d97..b16080d246b 100644 --- a/src/liballoc/collections/vec_deque.rs +++ b/src/liballoc/collections/vec_deque.rs @@ -1988,11 +1988,11 @@ pub struct Iter<'a, T: 'a> { #[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 { + let (front, back) = RingSlices::ring_slices(self.ring, self.head, self.tail); f.debug_tuple("Iter") - .field(&self.ring) - .field(&self.tail) - .field(&self.head) - .finish() + .field(&front) + .field(&back) + .finish() } } @@ -2085,11 +2085,11 @@ pub struct IterMut<'a, T: 'a> { #[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 { + let (front, back) = RingSlices::ring_slices(&*self.ring, self.head, self.tail); f.debug_tuple("IterMut") - .field(&self.ring) - .field(&self.tail) - .field(&self.head) - .finish() + .field(&front) + .field(&back) + .finish() } } |
