Skip to content

Add UnboundedIterator Trait #47082

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add FIXMEs
  • Loading branch information
oberien committed Dec 22, 2017
commit cbf23b667d79382eb1b1f370de38b996c19fa1e3
12 changes: 11 additions & 1 deletion src/libcore/iter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,10 @@ pub use self::traits::FusedIterator;
#[unstable(feature = "trusted_len", issue = "37572")]
pub use self::traits::TrustedLen;
#[unstable(feature = "unbounded_iter", issue = "0")]
pub use self::traits::{UnboundedIterator, UnboundedIteratorAuto};
pub use self::traits::UnboundedIterator;
// FIXME: #46813
//#[unstable(feature = "unbounded_iter", issue = "0")]
//pub use self::traits::UnboundedIteratorAuto;

mod iterator;
mod range;
Expand Down Expand Up @@ -705,6 +708,7 @@ impl<I> Iterator for StepBy<I> where I: Iterator {
}

// StepBy specialization trait
// FIXME: #36262
#[doc(hidden)]
trait StepByImpl {
fn size_hint(&self) -> (usize, Option<usize>);
Expand Down Expand Up @@ -976,6 +980,7 @@ impl<A, B> DoubleEndedIterator for Chain<A, B> where
}

// Chain specialization trait
// FIXME: #36262
#[doc(hidden)]
trait ChainImpl {
fn size_hint(&self) -> (usize, Option<usize>);
Expand Down Expand Up @@ -1577,6 +1582,7 @@ impl<I: DoubleEndedIterator, P> DoubleEndedIterator for Filter<I, P>
}

// Filter specialization trait
// FIXME: #36262
#[doc(hidden)]
trait FilterImpl {
fn size_hint(&self) -> (usize, Option<usize>);
Expand Down Expand Up @@ -1721,6 +1727,7 @@ impl<B, I: DoubleEndedIterator, F> DoubleEndedIterator for FilterMap<I, F>
}

// FilterMap specialization trait
// FIXME: #36262
#[doc(hidden)]
trait FilterMapImpl {
fn size_hint(&self) -> (usize, Option<usize>);
Expand Down Expand Up @@ -2170,6 +2177,7 @@ impl<I: Iterator, P> Iterator for SkipWhile<I, P>
}

// SkipWhile specialization trait
// FIXME: #36262
#[doc(hidden)]
trait SkipWhileImpl {
fn size_hint(&self) -> (usize, Option<usize>);
Expand Down Expand Up @@ -2418,6 +2426,7 @@ impl<I> DoubleEndedIterator for Skip<I> where I: DoubleEndedIterator + ExactSize
}

// Skip specialization trait
// FIXME: #36262
#[doc(hidden)]
trait SkipImpl {
fn size_hint(&self) -> (usize, Option<usize>);
Expand Down Expand Up @@ -2755,6 +2764,7 @@ impl<I: DoubleEndedIterator, U, F> DoubleEndedIterator for FlatMap<I, U, F> wher
}

// FlatMap specialization trait
// FIXME: #36262
#[doc(hidden)]
trait FlatMapImpl {
fn size_hint(&self) -> (usize, Option<usize>);
Expand Down
15 changes: 8 additions & 7 deletions src/libcore/iter/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1008,10 +1008,11 @@ unsafe impl<'a, I: UnboundedIterator + ?Sized> UnboundedIterator for &'a mut I {

// Hacky auto trait to allow specialization of iter::Chain,
// because it requares either A: UI or B: UI or both.
#[unstable(feature = "unbounded_iter", issue = "0")]
#[doc(hidden)]
pub auto trait UnboundedIteratorAuto {}

#[unstable(feature = "unbounded_iter", issue = "0")]
impl<A, B> !UnboundedIteratorAuto for (A, B)
where A: UnboundedIteratorAuto, B: UnboundedIteratorAuto {}
// FIXME: #46813
//#[unstable(feature = "unbounded_iter", issue = "0")]
//#[doc(hidden)]
//pub auto trait UnboundedIteratorAuto {}
//
//#[unstable(feature = "unbounded_iter", issue = "0")]
//impl<A, B> !UnboundedIteratorAuto for (A, B)
// where A: UnboundedIteratorAuto, B: UnboundedIteratorAuto {}