From 85796dd0bad3486f52e3ff9ecb0db6f52d3c460f Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Mon, 11 Jun 2018 23:10:51 +0200 Subject: [PATCH] stabilize Iterator::flatten in 1.29, fixes #48115. --- src/libcore/iter/iterator.rs | 8 +------- src/libcore/iter/mod.rs | 12 ++++++------ src/libcore/lib.rs | 1 - src/libcore/tests/lib.rs | 1 - 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/libcore/iter/iterator.rs b/src/libcore/iter/iterator.rs index 1972b0099053e..102e46dc0f48a 100644 --- a/src/libcore/iter/iterator.rs +++ b/src/libcore/iter/iterator.rs @@ -1036,8 +1036,6 @@ pub trait Iterator { /// Basic usage: /// /// ``` - /// #![feature(iterator_flatten)] - /// /// let data = vec![vec![1, 2, 3, 4], vec![5, 6]]; /// let flattened = data.into_iter().flatten().collect::>(); /// assert_eq!(flattened, &[1, 2, 3, 4, 5, 6]); @@ -1046,8 +1044,6 @@ pub trait Iterator { /// Mapping and then flattening: /// /// ``` - /// #![feature(iterator_flatten)] - /// /// let words = ["alpha", "beta", "gamma"]; /// /// // chars() returns an iterator @@ -1074,8 +1070,6 @@ pub trait Iterator { /// Flattening once only removes one level of nesting: /// /// ``` - /// #![feature(iterator_flatten)] - /// /// let d3 = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]]; /// /// let d2 = d3.iter().flatten().collect::>(); @@ -1093,7 +1087,7 @@ pub trait Iterator { /// /// [`flat_map()`]: #method.flat_map #[inline] - #[unstable(feature = "iterator_flatten", issue = "48213")] + #[stable(feature = "iterator_flatten", since = "1.29")] fn flatten(self) -> Flatten where Self: Sized, Self::Item: IntoIterator { Flatten { inner: flatten_compat(self) } diff --git a/src/libcore/iter/mod.rs b/src/libcore/iter/mod.rs index f152ee73b6996..9ab3b786e9218 100644 --- a/src/libcore/iter/mod.rs +++ b/src/libcore/iter/mod.rs @@ -2524,13 +2524,13 @@ impl FusedIterator for FlatMap /// [`flatten`]: trait.Iterator.html#method.flatten /// [`Iterator`]: trait.Iterator.html #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[unstable(feature = "iterator_flatten", issue = "48213")] +#[stable(feature = "iterator_flatten", since = "1.29")] pub struct Flatten where I::Item: IntoIterator { inner: FlattenCompat::IntoIter>, } -#[unstable(feature = "iterator_flatten", issue = "48213")] +#[stable(feature = "iterator_flatten", since = "1.29")] impl fmt::Debug for Flatten where I: Iterator + fmt::Debug, U: Iterator + fmt::Debug, I::Item: IntoIterator, @@ -2540,7 +2540,7 @@ impl fmt::Debug for Flatten } } -#[unstable(feature = "iterator_flatten", issue = "48213")] +#[stable(feature = "iterator_flatten", since = "1.29")] impl Clone for Flatten where I: Iterator + Clone, U: Iterator + Clone, I::Item: IntoIterator, @@ -2548,7 +2548,7 @@ impl Clone for Flatten fn clone(&self) -> Self { Flatten { inner: self.inner.clone() } } } -#[unstable(feature = "iterator_flatten", issue = "48213")] +#[stable(feature = "iterator_flatten", since = "1.29")] impl Iterator for Flatten where I: Iterator, U: Iterator, I::Item: IntoIterator @@ -2576,7 +2576,7 @@ impl Iterator for Flatten } } -#[unstable(feature = "iterator_flatten", issue = "48213")] +#[stable(feature = "iterator_flatten", since = "1.29")] impl DoubleEndedIterator for Flatten where I: DoubleEndedIterator, U: DoubleEndedIterator, I::Item: IntoIterator @@ -2599,7 +2599,7 @@ impl DoubleEndedIterator for Flatten } } -#[unstable(feature = "iterator_flatten", issue = "48213")] +#[stable(feature = "iterator_flatten", since = "1.29")] impl FusedIterator for Flatten where I: FusedIterator, U: Iterator, I::Item: IntoIterator {} diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index a2ee0033872d3..4edfb06944ba9 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -89,7 +89,6 @@ #![feature(extern_types)] #![feature(fundamental)] #![feature(intrinsics)] -#![feature(iterator_flatten)] #![feature(lang_items)] #![feature(link_llvm_intrinsics)] #![feature(never_type)] diff --git a/src/libcore/tests/lib.rs b/src/libcore/tests/lib.rs index 11765e3ef56ee..4c8f72010a2d2 100644 --- a/src/libcore/tests/lib.rs +++ b/src/libcore/tests/lib.rs @@ -23,7 +23,6 @@ #![feature(flt2dec)] #![feature(fmt_internals)] #![feature(hashmap_internals)] -#![feature(iterator_flatten)] #![feature(pattern)] #![feature(range_is_empty)] #![feature(raw)]