diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2015-01-19 09:48:05 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2015-01-19 10:41:07 -0500 |
| commit | 74e111caf6d9634917f77977a4e51e562498be87 (patch) | |
| tree | 863e11c5233cb453debc99ec3057f9f37bdbbff4 /src/liballoc | |
| parent | 43f2c199e4e87d7ccd15658c52ad8dc5a1d54fb9 (diff) | |
| download | rust-74e111caf6d9634917f77977a4e51e562498be87.tar.gz rust-74e111caf6d9634917f77977a4e51e562498be87.zip | |
impl Iterator for &mut Iterator and Box<Iterator>
closes #20953 closes #21361
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/boxed.rs | 11 | ||||
| -rw-r--r-- | src/liballoc/lib.rs | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 8ad0c152dc8..89de2c953e4 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -18,6 +18,7 @@ use core::cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering}; use core::default::Default; use core::fmt; use core::hash::{self, Hash}; +use core::iter::Iterator; use core::marker::Sized; use core::mem; use core::option::Option; @@ -185,6 +186,16 @@ impl<T: ?Sized> DerefMut for Box<T> { fn deref_mut(&mut self) -> &mut T { &mut **self } } +// FIXME(#21363) remove `old_impl_check` when bug is fixed +#[old_impl_check] +impl<'a, T> Iterator for Box<Iterator<Item=T> + 'a> { + type Item = T; + + fn next(&mut self) -> Option<T> { + (**self).next() + } +} + #[cfg(test)] mod test { #[test] diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 811e32e747d..47715fe9e5d 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -70,6 +70,8 @@ #![feature(lang_items, unsafe_destructor)] #![feature(box_syntax)] #![feature(optin_builtin_traits)] +// FIXME(#21363) remove `old_impl_check` when bug is fixed +#![feature(old_impl_check)] #![allow(unknown_features)] #![feature(int_uint)] #[macro_use] |
