Skip to content

Commit af3c315

Browse files
authored
Rollup merge of #68800 - JohnTitor:stabilize-once-with, r=Centril
Stabilize `core::iter::once_with()` Fixes #57581 FCP: #57581 (comment) r? @SimonSapin
2 parents f17f97d + 7e2d7e0 commit af3c315

File tree

4 files changed

+8
-14
lines changed

4 files changed

+8
-14
lines changed

src/libcore/iter/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ pub use self::sources::{empty, Empty};
327327
pub use self::sources::{from_fn, FromFn};
328328
#[stable(feature = "iter_once", since = "1.2.0")]
329329
pub use self::sources::{once, Once};
330-
#[unstable(feature = "iter_once_with", issue = "57581")]
330+
#[stable(feature = "iter_once_with", since = "1.43.0")]
331331
pub use self::sources::{once_with, OnceWith};
332332
#[stable(feature = "rust1", since = "1.0.0")]
333333
pub use self::sources::{repeat, Repeat};

src/libcore/iter/sources.rs

+7-11
Original file line numberDiff line numberDiff line change
@@ -399,12 +399,12 @@ pub fn once<T>(value: T) -> Once<T> {
399399
///
400400
/// [`once_with`]: fn.once_with.html
401401
#[derive(Copy, Clone, Debug)]
402-
#[unstable(feature = "iter_once_with", issue = "57581")]
402+
#[stable(feature = "iter_once_with", since = "1.43.0")]
403403
pub struct OnceWith<F> {
404404
gen: Option<F>,
405405
}
406406

407-
#[unstable(feature = "iter_once_with", issue = "57581")]
407+
#[stable(feature = "iter_once_with", since = "1.43.0")]
408408
impl<A, F: FnOnce() -> A> Iterator for OnceWith<F> {
409409
type Item = A;
410410

@@ -420,24 +420,24 @@ impl<A, F: FnOnce() -> A> Iterator for OnceWith<F> {
420420
}
421421
}
422422

423-
#[unstable(feature = "iter_once_with", issue = "57581")]
423+
#[stable(feature = "iter_once_with", since = "1.43.0")]
424424
impl<A, F: FnOnce() -> A> DoubleEndedIterator for OnceWith<F> {
425425
fn next_back(&mut self) -> Option<A> {
426426
self.next()
427427
}
428428
}
429429

430-
#[unstable(feature = "iter_once_with", issue = "57581")]
430+
#[stable(feature = "iter_once_with", since = "1.43.0")]
431431
impl<A, F: FnOnce() -> A> ExactSizeIterator for OnceWith<F> {
432432
fn len(&self) -> usize {
433433
self.gen.iter().len()
434434
}
435435
}
436436

437-
#[unstable(feature = "iter_once_with", issue = "57581")]
437+
#[stable(feature = "iter_once_with", since = "1.43.0")]
438438
impl<A, F: FnOnce() -> A> FusedIterator for OnceWith<F> {}
439439

440-
#[unstable(feature = "iter_once_with", issue = "57581")]
440+
#[stable(feature = "iter_once_with", since = "1.43.0")]
441441
unsafe impl<A, F: FnOnce() -> A> TrustedLen for OnceWith<F> {}
442442

443443
/// 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> {}
458458
/// Basic usage:
459459
///
460460
/// ```
461-
/// #![feature(iter_once_with)]
462-
///
463461
/// use std::iter;
464462
///
465463
/// // one is the loneliest number
@@ -476,8 +474,6 @@ unsafe impl<A, F: FnOnce() -> A> TrustedLen for OnceWith<F> {}
476474
/// `.foorc`:
477475
///
478476
/// ```no_run
479-
/// #![feature(iter_once_with)]
480-
///
481477
/// use std::iter;
482478
/// use std::fs;
483479
/// use std::path::PathBuf;
@@ -500,7 +496,7 @@ unsafe impl<A, F: FnOnce() -> A> TrustedLen for OnceWith<F> {}
500496
/// }
501497
/// ```
502498
#[inline]
503-
#[unstable(feature = "iter_once_with", issue = "57581")]
499+
#[stable(feature = "iter_once_with", since = "1.43.0")]
504500
pub fn once_with<A, F: FnOnce() -> A>(gen: F) -> OnceWith<F> {
505501
OnceWith { gen: Some(gen) }
506502
}

src/libcore/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@
8787
#![feature(intrinsics)]
8888
#![feature(try_find)]
8989
#![feature(is_sorted)]
90-
#![feature(iter_once_with)]
9190
#![feature(lang_items)]
9291
#![feature(link_llvm_intrinsics)]
9392
#![feature(never_type)]

src/libcore/tests/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#![feature(hashmap_internals)]
1414
#![feature(try_find)]
1515
#![feature(is_sorted)]
16-
#![feature(iter_once_with)]
1716
#![feature(pattern)]
1817
#![feature(range_is_empty)]
1918
#![feature(raw)]

0 commit comments

Comments
 (0)