diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-02-03 18:58:37 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-03 18:58:37 +0100 |
| commit | af3c315dafae5a40f4794635461625ab712d3582 (patch) | |
| tree | 46e8f409b07c23138be597bde715fe944f4274ce | |
| parent | f17f97d36a41a1ca4c9f9bc3ecec9b30b5555583 (diff) | |
| parent | 7e2d7e0bbcc8c20320a32778dafd07a3aa111384 (diff) | |
| download | rust-af3c315dafae5a40f4794635461625ab712d3582.tar.gz rust-af3c315dafae5a40f4794635461625ab712d3582.zip | |
Rollup merge of #68800 - JohnTitor:stabilize-once-with, r=Centril
Stabilize `core::iter::once_with()` Fixes #57581 FCP: https://github.com/rust-lang/rust/issues/57581#issuecomment-576178031 r? @SimonSapin
| -rw-r--r-- | src/libcore/iter/mod.rs | 2 | ||||
| -rw-r--r-- | src/libcore/iter/sources.rs | 18 | ||||
| -rw-r--r-- | src/libcore/lib.rs | 1 | ||||
| -rw-r--r-- | 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<T>(value: T) -> Once<T> { /// /// [`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<F> { gen: Option<F>, } -#[unstable(feature = "iter_once_with", issue = "57581")] +#[stable(feature = "iter_once_with", since = "1.43.0")] impl<A, F: FnOnce() -> A> Iterator for OnceWith<F> { type Item = A; @@ -420,24 +420,24 @@ impl<A, F: FnOnce() -> A> Iterator for OnceWith<F> { } } -#[unstable(feature = "iter_once_with", issue = "57581")] +#[stable(feature = "iter_once_with", since = "1.43.0")] impl<A, F: FnOnce() -> A> DoubleEndedIterator for OnceWith<F> { fn next_back(&mut self) -> Option<A> { self.next() } } -#[unstable(feature = "iter_once_with", issue = "57581")] +#[stable(feature = "iter_once_with", since = "1.43.0")] impl<A, F: FnOnce() -> A> ExactSizeIterator for OnceWith<F> { 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, F: FnOnce() -> A> FusedIterator for OnceWith<F> {} -#[unstable(feature = "iter_once_with", issue = "57581")] +#[stable(feature = "iter_once_with", since = "1.43.0")] unsafe impl<A, F: FnOnce() -> A> TrustedLen for OnceWith<F> {} /// Creates an iterator that lazily generates a value exactly once by invoking @@ -458,8 +458,6 @@ unsafe impl<A, F: FnOnce() -> A> TrustedLen for OnceWith<F> {} /// Basic usage: /// /// ``` -/// #![feature(iter_once_with)] -/// /// use std::iter; /// /// // one is the loneliest number @@ -476,8 +474,6 @@ unsafe impl<A, F: FnOnce() -> A> TrustedLen for OnceWith<F> {} /// `.foorc`: /// /// ```no_run -/// #![feature(iter_once_with)] -/// /// use std::iter; /// use std::fs; /// use std::path::PathBuf; @@ -500,7 +496,7 @@ unsafe impl<A, F: FnOnce() -> A> TrustedLen for OnceWith<F> {} /// } /// ``` #[inline] -#[unstable(feature = "iter_once_with", issue = "57581")] +#[stable(feature = "iter_once_with", since = "1.43.0")] pub fn once_with<A, F: FnOnce() -> A>(gen: F) -> OnceWith<F> { 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)] |
