about summary refs log tree commit diff
path: root/library/core/src/iter/sources
AgeCommit message (Collapse)AuthorLines
2025-09-16Iterator repeat: no infinite loop for `last` and `count`Marijn Schouten-3/+4
2025-07-13update issue number for `const_trait_impl`Deadbeef-1/+1
2025-07-07Make `Default` const and add some `const Default` implsEsteban Küber-1/+2
Full list of `impl const Default` types: - () - bool - char - Cell - std::ascii::Char - usize - u8 - u16 - u32 - u64 - u128 - i8 - i16 - i32 - i64 - i128 - f16 - f32 - f64 - f128 - std::marker::PhantomData<T> - Option<T> - std::iter::Empty<T> - std::ptr::Alignment - &[T] - &mut [T] - &str - &mut str - String - Vec<T>
2025-06-26Tracking issue number for `iter_macro`Pavel Grigorenko-1/+1
2025-06-13100% safe implementation of RepeatNSoveu-118/+43
2025-06-07Fix usage of `bootstrap` in coreUrgau-4/+1
2025-06-03Add `iter` macroOli Scherer-0/+29
This adds an `iter!` macro that can be used to create movable generators. This also adds a yield_expr feature so the `yield` keyword can be used within iter! macro bodies. This was needed because several unstable features each need `yield` expressions, so this allows us to stabilize them separately from any individual feature. Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de> Co-authored-by: Jieyou Xu <jieyouxu@outlook.com> Co-authored-by: Travis Cross <tc@traviscross.com>
2025-03-22core: optimize `RepeatN`joboet-4/+55
...by adding an optimized implementation of `try_fold` and `fold` as well as replacing some unnecessary `mem::replace` calls with `MaybeUninit` helper methods.
2025-03-16Rollup merge of #138082 - thaliaarchi:slice-cfg-not-test, r=thomcc许杰友 Jieyou Xu (Joe)-1/+1
Remove `#[cfg(not(test))]` gates in `core` These gates are unnecessary now that unit tests for `core` are in a separate package, `coretests`, instead of in the same files as the source code. They previously prevented the two `core` versions from conflicting with each other.
2025-03-06Remove #[cfg(not(test))] gates in coreThalia Archibald-1/+1
These gates are unnecessary now that unit tests for `core` are in a separate package, `coretests`, instead of in the same files as the source code. They previously prevented the two `core` versions from conflicting with each other.
2025-03-06Rollup merge of #135895 - hkBst:patch-15, r=joboetMichael Goulet-5/+11
Document workings of successors more clearly This is an attempt to fix #135087 together with https://github.com/rust-lang/rust/pull/135886, but I am not sure if I've succeeded in adding much clarity here, so don't be shy with your comments.
2025-03-02Document workings of successors more clearlyMarijn Schouten-5/+11
This is an attempt to fix #135087 together with https://github.com/rust-lang/rust/pull/135886, but I am not sure if I've succeeded in adding much clarity here, so don't be shy with your comments.
2025-02-09Rename field in OnceWith from gen to makeMichael Goulet-7/+7
2025-02-05Fix link in from_fn.rsMarijn Schouten-1/+1
2025-01-26Document purpose of closure in from_fn.rs more clearlyMarijn Schouten-2/+2
2025-01-05Clarified the documentation on core::iter::from_fn and core::iter::successorsranger-ross-0/+3
2024-12-21Less unwrap() in documentationKornel-1/+2
2024-10-18remove outdated documentation for `repeat_n`AnthonyMikh-3/+1
After rust/#106943 the part about `ExactSizeIterator` is no longer valid
2024-09-09`RepeatN`: use MaybeUninitDeadbeef-15/+45
2024-09-03replace placeholder versionBoxy-8/+8
2024-08-19Stabilize `iter::repeat_n`Scott McMurray-10/+8
2024-08-01Implement `UncheckedIterator` directly for `RepeatN`Scott McMurray-13/+20
2024-07-29Reformat `use` declarations.Nicholas Nethercote-3/+3
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-14doc: Suggest `str::repeat` over `iter::repeat().take().collect()`tesuji-0/+4
Using ../../std syntax because of difficulty link alloc stuff to core.
2024-06-19core: implement `UncheckedIterator` for `RepeatN`joboet-1/+3
2024-05-01Step bootstrap cfgsMark Rousskov-1/+1
2024-04-24Error on using `yield` without also using `#[coroutine]` on the closureOli Scherer-1/+1
And suggest adding the `#[coroutine]` to the closure
2024-02-15Replace `NonZero::<_>::new` with `NonZero::new`.Markus Reiter-1/+1
2024-02-15Use generic `NonZero` internally.Markus Reiter-7/+7
2024-01-16Un-hide `iter::repeat_n`Scott McMurray-2/+0
2023-11-15Bump cfg(bootstrap)sMark Rousskov-2/+1
2023-10-20Fix stage0 core testsOli Scherer-1/+2
2023-10-20s/generator/coroutine/Oli Scherer-14/+14
2023-10-20s/Generator/Coroutine/Oli Scherer-9/+9
2023-10-06Rollup merge of #116198 - Jarcho:diag_items, r=WaffleLapkinGuillaume Gomez-0/+2
Add more diagnostic items for clippy
2023-10-05Add more diagnostic items for clippyJason Newcomb-0/+2
2023-09-05fix a comment in std::iter::successorsJuly Tikhonov-1/+1
The `unfold` function have since been renamed to `from_fn`.
2023-06-14Fix typoAntonios Barotsis-1/+1
2023-04-16rm const traits in libcoreDeadbeef-2/+1
2023-04-12remove some unneeded importsKaDiWa-1/+0
2023-03-27replace advance_by returning usize with Result<(), NonZeroUsize>The 8472-8/+11
2023-03-27Change advance(_back)_by to return `usize` instead of `Result<(), usize>`The 8472-8/+8
A successful advance is now signalled by returning `0` and other values now represent the remaining number of steps that couldn't be advanced as opposed to the amount of steps that have been advanced during a partial advance_by. This simplifies adapters a bit, replacing some `match`/`if` with arithmetic. Whether this is beneficial overall depends on whether `advance_by` is mostly used as a building-block for other iterator methods and adapters or whether we also see uses by users where `Result` might be more useful.
2023-01-25Set version placeholders to 1.68Mark Rousskov-2/+2
2023-01-14Rollup merge of #105526 - Xiretza:iter-from-generator-derive, r=scottmcmMatthias Krüger-4/+19
libcore: make result of iter::from_generator Clone `@rustbot` label +A-generators
2023-01-08Rollup merge of #104163 - H4x5:once-repeat-with-debug, r=dtolnayMichael Goulet-2/+22
Don't derive Debug for `OnceWith` & `RepeatWith` Closures don't impl Debug, so the derived impl is kinda useless. The behavior of not debug-printing closures is consistent with the rest of the iterator adapters/sources.
2023-01-07Don't derive Debug for `OnceWith` & `RepeatWith`Sky-2/+22
2023-01-07Change to immutable borrow when cloning element of RepeatNFolyd-1/+1
2022-12-28Rollup merge of #103945 - H4x5:remove-iter-empty-hack, r=compiler-errorsfee1-dead-6/+1
Remove `iter::Empty` hack `iter::Empty` uses a newtype to work around `#![feature(const_fn_fn_ptr_basics)]`, which has been stable since 1.61.0.
2022-12-10libcore: make result of iter::from_generator CloneXiretza-0/+1
This is currently only relevant with #![feature(generator_clone)].
2022-12-10libcore: make result type of iter::from_generator concreteXiretza-4/+18
This allows for propagating trait impls on the iterator type.