diff options
| author | bors <bors@rust-lang.org> | 2015-02-04 06:40:12 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-02-04 06:40:12 +0000 |
| commit | d6c15d9b2daecdbe32eca894bda40c424798f5a0 (patch) | |
| tree | a9e08bd10dc4cb6cb0d489e120001c3445e89b00 /src/liballoc | |
| parent | 3b2ed14906fd9f9daa27cc7d1dad263d2f5ff450 (diff) | |
| parent | 70ecd8ed38d5bedbeb281d78c3da44477764236a (diff) | |
| download | rust-d6c15d9b2daecdbe32eca894bda40c424798f5a0.tar.gz rust-d6c15d9b2daecdbe32eca894bda40c424798f5a0.zip | |
Auto merge of #21919 - alexcrichton:rollup, r=alexcrichton
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/boxed.rs | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 504b58d8ad1..340a8d59612 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -45,22 +45,18 @@ #![stable(feature = "rust1", since = "1.0.0")] +use core::prelude::*; + use core::any::Any; -use core::clone::Clone; -use core::cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering}; +use core::cmp::Ordering; use core::default::Default; use core::error::{Error, FromError}; use core::fmt; use core::hash::{self, Hash}; -use core::iter::Iterator; -use core::marker::Sized; use core::mem; use core::ops::{Deref, DerefMut}; -use core::option::Option; use core::ptr::Unique; use core::raw::TraitObject; -use core::result::Result::{Ok, Err}; -use core::result::Result; /// A value that represents the heap. This is the default place that the `box` keyword allocates /// into when no place is supplied. @@ -296,18 +292,20 @@ impl<T: ?Sized> DerefMut for Box<T> { fn deref_mut(&mut self) -> &mut T { &mut **self } } -impl<'a, T> Iterator for Box<Iterator<Item=T> + 'a> { - type Item = T; - - fn next(&mut self) -> Option<T> { - (**self).next() - } - - fn size_hint(&self) -> (usize, Option<usize>) { - (**self).size_hint() - } +#[stable(feature = "rust1", since = "1.0.0")] +impl<I: Iterator + ?Sized> Iterator for Box<I> { + type Item = I::Item; + fn next(&mut self) -> Option<I::Item> { (**self).next() } + fn size_hint(&self) -> (usize, Option<usize>) { (**self).size_hint() } +} +#[stable(feature = "rust1", since = "1.0.0")] +impl<I: DoubleEndedIterator + ?Sized> DoubleEndedIterator for Box<I> { + fn next_back(&mut self) -> Option<I::Item> { (**self).next_back() } } +#[stable(feature = "rust1", since = "1.0.0")] +impl<I: ExactSizeIterator + ?Sized> ExactSizeIterator for Box<I> {} +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, E: Error + 'a> FromError<E> for Box<Error + 'a> { fn from_error(err: E) -> Box<Error + 'a> { Box::new(err) |
