diff --git a/src/libextra/bitv.rs b/src/libextra/bitv.rs index 63d62bd4809..03588d984d9 100644 --- a/src/libextra/bitv.rs +++ b/src/libextra/bitv.rs @@ -608,6 +608,8 @@ impl<'self> DoubleEndedIterator for BitvIterator<'self> { } } +impl<'self> ExactSize for BitvIterator<'self> {} + impl<'self> RandomAccessIterator for BitvIterator<'self> { #[inline] fn indexable(&self) -> uint { diff --git a/src/libextra/dlist.rs b/src/libextra/dlist.rs index 8e641073637..075a0fa7777 100644 --- a/src/libextra/dlist.rs +++ b/src/libextra/dlist.rs @@ -472,6 +472,8 @@ impl<'self, A> DoubleEndedIterator<&'self A> for DListIterator<'self, A> { } } +impl<'self, A> ExactSize<&'self A> for DListIterator<'self, A> {} + impl<'self, A> Iterator<&'self mut A> for MutDListIterator<'self, A> { #[inline] fn next(&mut self) -> Option<&'self mut A> { @@ -508,6 +510,7 @@ impl<'self, A> DoubleEndedIterator<&'self mut A> for MutDListIterator<'self, A> } } +impl<'self, A> ExactSize<&'self mut A> for MutDListIterator<'self, A> {} /// Allow mutating the DList while iterating pub trait ListInsertion { diff --git a/src/libextra/ringbuf.rs b/src/libextra/ringbuf.rs index 4f2755374af..9ae9b47e207 100644 --- a/src/libextra/ringbuf.rs +++ b/src/libextra/ringbuf.rs @@ -243,6 +243,8 @@ pub struct RingBufIterator<'self, T> { iterator!{impl RingBufIterator -> &'self T, get_ref} iterator_rev!{impl RingBufIterator -> &'self T, get_ref} +impl<'self, T> ExactSize<&'self T> for RingBufIterator<'self, T> {} + impl<'self, T> RandomAccessIterator<&'self T> for RingBufIterator<'self, T> { #[inline] fn indexable(&self) -> uint { self.rindex - self.index } @@ -268,6 +270,8 @@ pub struct RingBufMutIterator<'self, T> { iterator!{impl RingBufMutIterator -> &'self mut T, get_mut_ref} iterator_rev!{impl RingBufMutIterator -> &'self mut T, get_mut_ref} +impl<'self, T> ExactSize<&'self mut T> for RingBufMutIterator<'self, T> {} + /// Grow is only called on full elts, so nelts is also len(elts), unlike /// elsewhere. fn grow(nelts: uint, loptr: &mut uint, elts: &mut ~[Option]) { diff --git a/src/libstd/option.rs b/src/libstd/option.rs index f99a595f2eb..dd66630187d 100644 --- a/src/libstd/option.rs +++ b/src/libstd/option.rs @@ -46,7 +46,7 @@ use cmp::{Eq,Ord}; use util; use num::Zero; use iterator; -use iterator::{Iterator, DoubleEndedIterator}; +use iterator::{Iterator, DoubleEndedIterator, ExactSize}; use str::{StrSlice, OwnedStr}; use to_str::ToStr; use clone::DeepClone; @@ -402,6 +402,8 @@ impl DoubleEndedIterator for OptionIterator { } } +impl ExactSize for OptionIterator {} + #[cfg(test)] mod tests { use super::*;