Conversation
ArrayWindows and CircularArrayWindows are the only public adaptor structs with neither, so dropping one is silent and neither can satisfy a T: FusedIterator bound. Both already hold a Fuse<I>, and the tuple analogues TupleWindows and CircularTupleWindows carry both.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CONTRIBUTING.md:37asks every adaptor struct for#[must_use = "iterator adaptors are lazy and do nothing unless consumed"], and:148asks forFusedIteratoron every iterator that keeps returningNone.ArrayWindowsandCircularArrayWindowshave neither, and they are the only public adaptor structs in that position.The tuple analogues already do:
TupleWindowsatsrc/tuple_impl.rs:164and:231,CircularTupleWindowsat:245and:298. Both array types hold aFuse<I>(src/array_impl.rs:15,:104), so they genuinely never yieldSomeafterNone.The timeline explains it rather than blaming anyone: the
must_usesweep in #794 merged in 2023, andsrc/array_impl.rsarrived in 2026 with #1086, after it.What changes for a caller:
does not compile on master (
the trait bound ... FusedIterator is not satisfied, twice) and compiles with this. Anditer.array_windows::<2>();as a statement is currently silent.Verification
Base
fd61933.src/array_impl.rsmd5T: FusedIteratorbound#![deny(unused_must_use)]probe3280744618TupleWindows)1e83c4a3c5TupleWindows)FusedIteratoronly62800dda97must_useonlye591ff4370Each half removed alone is caught by a different probe.
TupleWindowsappears unchanged in all four rows, which is the control that the probes are measuring what I think.Gates as
.github/workflows/ci.ymlwrites them:cargo fmt --checkclean;cargo test --all-features14 result blocks, 0 failures;cargo +1.63.0 no-dev-deps check(the MSRV job, exact command) exit 0.RUSTFLAGS="--deny warnings" cargo clippy --all-featuresfails, identically on an unmodified tree, onclippy::question_markinsrc/lib.rs,src/adaptors/mod.rsandsrc/multipeek_impl.rs;src/array_impl.rsdoes not appear in either error list. That is open PR #1128.The
fused_array_windowsrow intests/quick.rsfollows the 17 existingfused_*rows, butis_fusedis a runtime check and these adaptors already behave fused, so that row passes on master too. It documents the behaviour rather than guarding the impls; the trait bound above is what actually diverges. Happy to drop it if you would rather not have a row that cannot fail.#1118is open on this file addingsize_hintandExactSizeIterator; the hunks are adjacent but distinct, and I have not touched either.Disclosure: written with the help of Claude (an AI assistant). Every result above is from runs on my machine.