From 06dd4c03a08dccb86337fd7913b2002ac1877aa3 Mon Sep 17 00:00:00 2001 From: inquisitivecrystal <22333129+inquisitivecrystal@users.noreply.github.com> Date: Tue, 31 Aug 2021 14:35:12 -0700 Subject: [PATCH] Stabilize `Iterator::intersperse()` --- library/core/src/iter/adapters/intersperse.rs | 12 ++++++------ library/core/src/iter/adapters/mod.rs | 2 +- library/core/src/iter/mod.rs | 2 +- library/core/src/iter/traits/iterator.rs | 14 ++++---------- library/core/tests/lib.rs | 1 - src/librustdoc/lib.rs | 1 - 6 files changed, 12 insertions(+), 20 deletions(-) diff --git a/library/core/src/iter/adapters/intersperse.rs b/library/core/src/iter/adapters/intersperse.rs index d8bbd424cf258..bd21872e1ad4b 100644 --- a/library/core/src/iter/adapters/intersperse.rs +++ b/library/core/src/iter/adapters/intersperse.rs @@ -4,7 +4,7 @@ use super::Peekable; /// /// This `struct` is created by [`Iterator::intersperse`]. See its documentation /// for more information. -#[unstable(feature = "iter_intersperse", reason = "recently added", issue = "79524")] +#[stable(feature = "iter_intersperse", since = "1.56.0")] #[derive(Debug, Clone)] pub struct Intersperse where @@ -24,7 +24,7 @@ where } } -#[unstable(feature = "iter_intersperse", reason = "recently added", issue = "79524")] +#[stable(feature = "iter_intersperse", since = "1.56.0")] impl Iterator for Intersperse where I: Iterator, @@ -61,7 +61,7 @@ where /// /// This `struct` is created by [`Iterator::intersperse_with`]. See its /// documentation for more information. -#[unstable(feature = "iter_intersperse", reason = "recently added", issue = "79524")] +#[stable(feature = "iter_intersperse", since = "1.56.0")] pub struct IntersperseWith where I: Iterator, @@ -71,7 +71,7 @@ where needs_sep: bool, } -#[unstable(feature = "iter_intersperse", reason = "recently added", issue = "79524")] +#[stable(feature = "iter_intersperse", since = "1.56.0")] impl crate::fmt::Debug for IntersperseWith where I: Iterator + crate::fmt::Debug, @@ -87,7 +87,7 @@ where } } -#[unstable(feature = "iter_intersperse", reason = "recently added", issue = "79524")] +#[stable(feature = "iter_intersperse", since = "1.56.0")] impl crate::clone::Clone for IntersperseWith where I: Iterator + crate::clone::Clone, @@ -113,7 +113,7 @@ where } } -#[unstable(feature = "iter_intersperse", reason = "recently added", issue = "79524")] +#[stable(feature = "iter_intersperse", since = "1.56.0")] impl Iterator for IntersperseWith where I: Iterator, diff --git a/library/core/src/iter/adapters/mod.rs b/library/core/src/iter/adapters/mod.rs index 056ccca1d01c9..f02d278aff5e4 100644 --- a/library/core/src/iter/adapters/mod.rs +++ b/library/core/src/iter/adapters/mod.rs @@ -42,7 +42,7 @@ pub use self::flatten::Flatten; #[stable(feature = "iter_copied", since = "1.36.0")] pub use self::copied::Copied; -#[unstable(feature = "iter_intersperse", reason = "recently added", issue = "79524")] +#[stable(feature = "iter_intersperse", since = "1.56.0")] pub use self::intersperse::{Intersperse, IntersperseWith}; #[unstable(feature = "iter_map_while", reason = "recently added", issue = "68537")] diff --git a/library/core/src/iter/mod.rs b/library/core/src/iter/mod.rs index 7fb80f954ff40..cd8a26025ffb6 100644 --- a/library/core/src/iter/mod.rs +++ b/library/core/src/iter/mod.rs @@ -414,7 +414,7 @@ pub use self::adapters::{ Chain, Cycle, Enumerate, Filter, FilterMap, FlatMap, Fuse, Inspect, Map, Peekable, Rev, Scan, Skip, SkipWhile, Take, TakeWhile, Zip, }; -#[unstable(feature = "iter_intersperse", reason = "recently added", issue = "79524")] +#[stable(feature = "iter_intersperse", since = "1.56.0")] pub use self::adapters::{Intersperse, IntersperseWith}; pub(crate) use self::adapters::process_results; diff --git a/library/core/src/iter/traits/iterator.rs b/library/core/src/iter/traits/iterator.rs index 850435b53cc7e..330d3714247c5 100644 --- a/library/core/src/iter/traits/iterator.rs +++ b/library/core/src/iter/traits/iterator.rs @@ -535,8 +535,6 @@ pub trait Iterator { /// Basic usage: /// /// ``` - /// #![feature(iter_intersperse)] - /// /// let mut a = [0, 1, 2].iter().intersperse(&100); /// assert_eq!(a.next(), Some(&0)); // The first element from `a`. /// assert_eq!(a.next(), Some(&100)); // The separator. @@ -547,9 +545,8 @@ pub trait Iterator { /// ``` /// /// `intersperse` can be very useful to join an iterator's items using a common element: - /// ``` - /// #![feature(iter_intersperse)] /// + /// ``` /// let hello = ["Hello", "World", "!"].iter().copied().intersperse(" ").collect::(); /// assert_eq!(hello, "Hello World !"); /// ``` @@ -557,7 +554,7 @@ pub trait Iterator { /// [`Clone`]: crate::clone::Clone /// [`intersperse_with`]: Iterator::intersperse_with #[inline] - #[unstable(feature = "iter_intersperse", reason = "recently added", issue = "79524")] + #[stable(feature = "iter_intersperse", since = "1.56.0")] fn intersperse(self, separator: Self::Item) -> Intersperse where Self: Sized, @@ -582,8 +579,6 @@ pub trait Iterator { /// Basic usage: /// /// ``` - /// #![feature(iter_intersperse)] - /// /// #[derive(PartialEq, Debug)] /// struct NotClone(usize); /// @@ -600,9 +595,8 @@ pub trait Iterator { /// /// `intersperse_with` can be used in situations where the separator needs /// to be computed: - /// ``` - /// #![feature(iter_intersperse)] /// + /// ``` /// let src = ["Hello", "to", "all", "people", "!!"].iter().copied(); /// /// // The closure mutably borrows its context to generate an item. @@ -615,7 +609,7 @@ pub trait Iterator { /// [`Clone`]: crate::clone::Clone /// [`intersperse`]: Iterator::intersperse #[inline] - #[unstable(feature = "iter_intersperse", reason = "recently added", issue = "79524")] + #[stable(feature = "iter_intersperse", since = "1.56.0")] fn intersperse_with(self, separator: G) -> IntersperseWith where Self: Sized, diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs index 13f483f19b770..7853b571be326 100644 --- a/library/core/tests/lib.rs +++ b/library/core/tests/lib.rs @@ -48,7 +48,6 @@ #![feature(int_log)] #![feature(iter_advance_by)] #![feature(iter_partition_in_place)] -#![feature(iter_intersperse)] #![feature(iter_is_partitioned)] #![feature(iter_order_by)] #![feature(iter_map_while)] diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index de32e31ca872f..b81acd1a93fc2 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -13,7 +13,6 @@ #![feature(never_type)] #![feature(once_cell)] #![feature(type_ascription)] -#![feature(iter_intersperse)] #![recursion_limit = "256"] #![warn(rustc::internal)]