diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 03c473ed9674..299864e3b3d7 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -1323,6 +1323,23 @@ impl ExactSizeIterator for Cloned where I: ExactSizeIterator, {} +#[unstable(feature = "core", reason = "trait is experimental")] +impl RandomAccessIterator for Cloned where + T: Clone, + D: Deref, + I: RandomAccessIterator +{ + #[inline] + fn indexable(&self) -> usize { + self.it.indexable() + } + + #[inline] + fn idx(&mut self, index: usize) -> Option { + self.it.idx(index).cloned() + } +} + /// An iterator that repeats endlessly #[derive(Clone)] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]