Stabilize Iterator::step_by

Fixes #27741
This commit is contained in:
Thayne McCombs 2018-06-02 20:42:42 -06:00
parent 4ecf12bf0e
commit 72e17b81fa
6 changed files with 4 additions and 18 deletions

View File

@ -15,7 +15,6 @@
#![feature(const_fn)]
#![feature(drain_filter)]
#![feature(exact_size_is_empty)]
#![feature(iterator_step_by)]
#![feature(pattern)]
#![feature(rand)]
#![feature(slice_sort_by_cached_key)]

View File

@ -283,7 +283,6 @@ pub trait Iterator {
/// Basic usage:
///
/// ```
/// #![feature(iterator_step_by)]
/// let a = [0, 1, 2, 3, 4, 5];
/// let mut iter = a.into_iter().step_by(2);
///
@ -293,9 +292,7 @@ pub trait Iterator {
/// assert_eq!(iter.next(), None);
/// ```
#[inline]
#[unstable(feature = "iterator_step_by",
reason = "unstable replacement of Range::step_by",
issue = "27741")]
#[stable(feature = "iterator_step_by", since = "1.28.0")]
fn step_by(self, step: usize) -> StepBy<Self> where Self: Sized {
assert!(step != 0);
StepBy{iter: self, step: step - 1, first_take: true}

View File

@ -673,9 +673,7 @@ impl<I> FusedIterator for Cycle<I> where I: Clone + Iterator {}
/// [`step_by`]: trait.Iterator.html#method.step_by
/// [`Iterator`]: trait.Iterator.html
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[unstable(feature = "iterator_step_by",
reason = "unstable replacement of Range::step_by",
issue = "27741")]
#[stable(feature = "iterator_step_by", since = "1.28.0")]
#[derive(Clone, Debug)]
pub struct StepBy<I> {
iter: I,
@ -683,9 +681,7 @@ pub struct StepBy<I> {
first_take: bool,
}
#[unstable(feature = "iterator_step_by",
reason = "unstable replacement of Range::step_by",
issue = "27741")]
#[stable(feature = "iterator_step_by", since = "1.28.0")]
impl<I> Iterator for StepBy<I> where I: Iterator {
type Item = I::Item;
@ -757,9 +753,7 @@ impl<I> Iterator for StepBy<I> where I: Iterator {
}
// StepBy can only make the iterator shorter, so the len will still fit.
#[unstable(feature = "iterator_step_by",
reason = "unstable replacement of Range::step_by",
issue = "27741")]
#[stable(feature = "iterator_step_by", since = "1.28.0")]
impl<I> ExactSizeIterator for StepBy<I> where I: ExactSizeIterator {}
/// An iterator that strings two iterators together.

View File

@ -23,7 +23,6 @@
#![feature(flt2dec)]
#![feature(fmt_internals)]
#![feature(hashmap_internals)]
#![feature(iterator_step_by)]
#![feature(iterator_flatten)]
#![feature(iterator_repeat_with)]
#![feature(pattern)]

View File

@ -10,8 +10,6 @@
// Test inclusive range syntax.
#![feature(iterator_step_by)]
use std::ops::{RangeInclusive, RangeToInclusive};
fn foo() -> isize { 42 }

View File

@ -14,7 +14,6 @@
#![feature(iter_empty)]
#![feature(iter_once)]
#![feature(iter_unfold)]
#![feature(iterator_step_by)]
#![feature(str_escape)]
use std::iter::{empty, once, repeat};