From 705e295b7b93c0861c9d8af4177f6701126683a9 Mon Sep 17 00:00:00 2001 From: Ulrik Sverdrup Date: Sat, 3 Dec 2016 22:47:33 +0100 Subject: [PATCH] iter: Forward ExactSizeIterator methods for &mut I --- src/libcore/iter/traits.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/libcore/iter/traits.rs b/src/libcore/iter/traits.rs index e94582cda7c..c5465549adf 100644 --- a/src/libcore/iter/traits.rs +++ b/src/libcore/iter/traits.rs @@ -552,7 +552,14 @@ pub trait ExactSizeIterator: Iterator { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, I: ExactSizeIterator + ?Sized> ExactSizeIterator for &'a mut I {} +impl<'a, I: ExactSizeIterator + ?Sized> ExactSizeIterator for &'a mut I { + fn len(&self) -> usize { + (**self).len() + } + fn is_empty(&self) -> bool { + (**self).is_empty() + } +} /// Trait to represent types that can be created by summing up an iterator. ///