Skip to content

Avoid reading beyond completed fixed-size chunks. - #1130

Open
RanaPriyansh wants to merge 1 commit into
rust-itertools:masterfrom
RanaPriyansh:fix/chunks-consumption-1035
Open

RanaPriyansh wants to merge 1 commit into
rust-itertools:masterfrom
RanaPriyansh:fix/chunks-consumption-1035

Conversation

@RanaPriyansh

Copy link
Copy Markdown

Fixes #1035.

Consuming a complete chunk reads one extra source element to detect the chunk boundary. That element is lost when the chunking adaptor is dropped. Track each chunk's remaining capacity and stop before reading beyond it. Release completed buffered chunks without reading another source element. Key-based grouping keeps its existing boundary detection.

The regression fails on the unpatched baseline and passes on the candidate. Tests cover source position, chunk boundaries, interleaved live chunks, partial drops, exhaustion, and bounded retention after repeated live chunk pairs. cargo test --all-features passes: 449 tests and 210 doctests. Strict documentation and formatting checks pass on Rust 1.97.

The four CI Clippy configurations fail on existing question_mark diagnostics. Baseline comparisons reproduce the same diagnostics in all four configurations. Rust 1.63 MSRV, Miri, and semver checks have not run locally.

Prepared with AI assistance.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.by_ref().chunks() consumes one extra element than expected

1 participant