Skip to content

ArrayChunks::into_remainder does not return None when there is no remainder #116000

Open
@hkBst

Description

@hkBst

I tried this code:

#![feature(iter_array_chunks)]

fn main() {
    let line = "abc";
    let mut chunks = line.chars().array_chunks::<3>();
    let _result: Vec<_> = chunks.by_ref().collect();
    if let Some(rem) = chunks.into_remainder() {
        assert!(rem.count() != 0);
    }
}

I expected to see this happen: into_remainder returns None when there is no remainder

Instead, this happened: into_remainder returns Some of an iterator with zero elements

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-libsRelevant to the library team, which will review and decide on the PR/issue.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions