From 7e2d7e0bbcc8c20320a32778dafd07a3aa111384 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Tue, 4 Feb 2020 00:47:04 +0900 Subject: [PATCH] Stabilize `core::iter::once_with()` --- src/libcore/iter/mod.rs | 2 +- src/libcore/iter/sources.rs | 18 +++++++----------- src/libcore/lib.rs | 1 - src/libcore/tests/lib.rs | 1 - 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/libcore/iter/mod.rs b/src/libcore/iter/mod.rs index d8a56cb3ae5..5fa9962f811 100644 --- a/src/libcore/iter/mod.rs +++ b/src/libcore/iter/mod.rs @@ -327,7 +327,7 @@ pub use self::sources::{empty, Empty}; pub use self::sources::{from_fn, FromFn}; #[stable(feature = "iter_once", since = "1.2.0")] pub use self::sources::{once, Once}; -#[unstable(feature = "iter_once_with", issue = "57581")] +#[stable(feature = "iter_once_with", since = "1.43.0")] pub use self::sources::{once_with, OnceWith}; #[stable(feature = "rust1", since = "1.0.0")] pub use self::sources::{repeat, Repeat}; diff --git a/src/libcore/iter/sources.rs b/src/libcore/iter/sources.rs index 25dfc573e41..5a31acab273 100644 --- a/src/libcore/iter/sources.rs +++ b/src/libcore/iter/sources.rs @@ -399,12 +399,12 @@ pub fn once(value: T) -> Once { /// /// [`once_with`]: fn.once_with.html #[derive(Copy, Clone, Debug)] -#[unstable(feature = "iter_once_with", issue = "57581")] +#[stable(feature = "iter_once_with", since = "1.43.0")] pub struct OnceWith { gen: Option, } -#[unstable(feature = "iter_once_with", issue = "57581")] +#[stable(feature = "iter_once_with", since = "1.43.0")] impl A> Iterator for OnceWith { type Item = A; @@ -420,24 +420,24 @@ impl A> Iterator for OnceWith { } } -#[unstable(feature = "iter_once_with", issue = "57581")] +#[stable(feature = "iter_once_with", since = "1.43.0")] impl A> DoubleEndedIterator for OnceWith { fn next_back(&mut self) -> Option { self.next() } } -#[unstable(feature = "iter_once_with", issue = "57581")] +#[stable(feature = "iter_once_with", since = "1.43.0")] impl A> ExactSizeIterator for OnceWith { fn len(&self) -> usize { self.gen.iter().len() } } -#[unstable(feature = "iter_once_with", issue = "57581")] +#[stable(feature = "iter_once_with", since = "1.43.0")] impl A> FusedIterator for OnceWith {} -#[unstable(feature = "iter_once_with", issue = "57581")] +#[stable(feature = "iter_once_with", since = "1.43.0")] unsafe impl A> TrustedLen for OnceWith {} /// Creates an iterator that lazily generates a value exactly once by invoking @@ -458,8 +458,6 @@ unsafe impl A> TrustedLen for OnceWith {} /// Basic usage: /// /// ``` -/// #![feature(iter_once_with)] -/// /// use std::iter; /// /// // one is the loneliest number @@ -476,8 +474,6 @@ unsafe impl A> TrustedLen for OnceWith {} /// `.foorc`: /// /// ```no_run -/// #![feature(iter_once_with)] -/// /// use std::iter; /// use std::fs; /// use std::path::PathBuf; @@ -500,7 +496,7 @@ unsafe impl A> TrustedLen for OnceWith {} /// } /// ``` #[inline] -#[unstable(feature = "iter_once_with", issue = "57581")] +#[stable(feature = "iter_once_with", since = "1.43.0")] pub fn once_with A>(gen: F) -> OnceWith { OnceWith { gen: Some(gen) } } diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index ce7ddffd825..7738ea2ac57 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -87,7 +87,6 @@ #![feature(intrinsics)] #![feature(try_find)] #![feature(is_sorted)] -#![feature(iter_once_with)] #![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 8fd19ef67fc..bfc3ee09dce 100644 --- a/src/libcore/tests/lib.rs +++ b/src/libcore/tests/lib.rs @@ -13,7 +13,6 @@ #![feature(hashmap_internals)] #![feature(try_find)] #![feature(is_sorted)] -#![feature(iter_once_with)] #![feature(pattern)] #![feature(range_is_empty)] #![feature(raw)]