Verify safety of slice iterator functions with Kani (Challenge 18)#560
Draft
jrey8343 wants to merge 1 commit intomodel-checking:mainfrom
Draft
Verify safety of slice iterator functions with Kani (Challenge 18)#560jrey8343 wants to merge 1 commit intomodel-checking:mainfrom
jrey8343 wants to merge 1 commit intomodel-checking:mainfrom
Conversation
Author
|
Note on "no monomorphization" requirement: We've asked for clarification on the tracking issue about whether Kani's representative-types approach (4 types covering all layout categories: ZST, small, validity-constrained, compound) satisfies this requirement. Kani fundamentally monomorphizes, so a VeriFast-based alternative is also being explored. See the tracking issue for details. |
Author
|
Update on "generic T" requirement: Same status as #559 — awaiting committee guidance on #281 re: representative types, and pursuing VeriFast Converting to draft until the path forward is clear. |
52 Kani proof harnesses covering iterator types across library/core/src/slice/iter.rs and iter/macros.rs: ## Iter (existing 18 harnesses, extended) - new, clone, count, default, as_slice, as_ref - next, next_back, nth, nth_back, advance_by, advance_back_by - is_empty, len, size_hint - post_inc_start, pre_dec_end, next_back_unchecked (unsafe) - Verified with: (), u8, char, (char, u8) ## IterMut (5 new harnesses) - new, into_slice, as_mut_slice, next, next_back ## Split (2 new harnesses) - next, next_back (with concrete predicate) ## Chunks (3 new harnesses) - next, next_back, __iterator_get_unchecked ## ChunksMut (4 new harnesses) - next, nth, next_back, nth_back ## ChunksExact / ChunksExactMut (5 new harnesses) - new (ChunksExact), next/nth/next_back/nth_back (ChunksExactMut) ## RChunks / RChunksMut (7 new harnesses) - next, next_back (RChunks) - next, nth, last, next_back, nth_back (RChunksMut) ## RChunksExact / RChunksExactMut (5 new harnesses) - new (RChunksExact) - next, nth, next_back, nth_back (RChunksExactMut) ## ArrayWindows (5 new harnesses, const generic) - next/next_back (N=1,2,4), nth/nth_back (N=2,4) ## Windows (1 new harness) - __iterator_get_unchecked ## __iterator_get_unchecked (6 new harnesses) - ChunksMut, ChunksExact, RChunks, RChunksMut, RChunksExact, RChunksExactMut ## Macro functions: fold, for_each, position, rposition (7 new harnesses) - Iter: fold, for_each, position, rposition - IterMut: fold, for_each, position Resolves model-checking#282 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0255442 to
7a49318
Compare
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.
Summary
52 Kani proof harnesses verifying safety of slice iterator functions in
library/core/src/slice/iter.rsanditer/macros.rs, covering Part 1 (macro-generated functions) and Part 2 (direct iterator implementations).Part 1: Macro Functions (Iter/IterMut)
nextnext_backnthnth_backadvance_byadvance_back_bylenis_emptysize_hintcountfoldfor_eachpositionrpositionlastPart 2: Iterator Type Functions
__iterator_get_unchecked__iterator_get_unchecked__iterator_get_unchecked__iterator_get_unchecked__iterator_get_unchecked__iterator_get_unchecked__iterator_get_unchecked__iterator_get_uncheckedVerification approach
kani::any()andkani::slice::any_slice_of_arrayiter.is_safe()assertionsTest plan
kani verify-std🤖 Generated with Claude Code