Skip to content

Preserve exhausted slice iterator state in specs - #1740

Merged
nilehmann merged 2 commits into
flux-rs:mainfrom
kimjune01:fix/iter-next-exhausted
Aug 31, 2026
Merged

Preserve exhausted slice iterator state in specs#1740
nilehmann merged 2 commits into
flux-rs:mainfrom
kimjune01:fix/iter-next-exhausted

Conversation

@kimjune01

Copy link
Copy Markdown
Contributor

Summary

  • preserve slice::Iter position when next is called after exhaustion
  • align the associated Iterator::step relation with the concrete method spec
  • cover direct, repeated, and generic exhausted calls

Rust leaves an exhausted slice iterator at the same position, but the current extern spec advances idx unconditionally. This creates impossible states with idx > len and makes concrete and generic iterator reasoning disagree.

The regression fails on main and passes with these changes.

Context

Test

PATH="$HOME/.cargo/bin:$PATH" cargo xtask test flux_core_slice00 --suite with-deps

@kimjune01
kimjune01 marked this pull request as ready for review August 28, 2026 17:43
@nilehmann
nilehmann merged commit e9ad032 into flux-rs:main Aug 31, 2026
19 checks passed
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.

2 participants