Closed
Description
I tried this code:
#![feature(iter_array_chunks)]
fn main() {
let x = [1].into_iter().array_chunks::<2>();
let x = x.into_remainder();
assert!(x.is_some());
}
I expected to see this happen:
There should be a remainder as 1
will not be yielded.
Instead, this happened:
Compiling playground v0.0.1 (/playground)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.47s
Running `target/debug/playground`
thread 'main' panicked at src/main.rs:7:5:
assertion failed: x.is_some()
If this is intended behavior, then it should probably be documented, as the current documentation of ArrayChunks::into_remainder states that it:
Returns an iterator over the remaining elements of the original iterator that are not going to be returned by this iterator. The returned iterator will yield at most N-1 elements.
Meta
rustc --version --verbose
:
rustc 1.79.0-nightly (805813650 2024-03-31)
binary: rustc
commit-hash: 805813650248c1a2f6f271460d728d1bb852d2a7
commit-date: 2024-03-31
host: x86_64-unknown-linux-gnu
release: 1.79.0-nightly
LLVM version: 18.1.2