Skip to content

Challenge 18: Kani contracts for slice iterators - #644

Open
sankalpsthakur wants to merge 8 commits into
model-checking:mainfrom
sankalpsthakur:challenge/18-slice-iter
Open

Challenge 18: Kani contracts for slice iterators#644
sankalpsthakur wants to merge 8 commits into
model-checking:mainfrom
sankalpsthakur:challenge/18-slice-iter

Conversation

@sankalpsthakur

Copy link
Copy Markdown

Summary

Kani safety contracts and proof harnesses for this challenge. Runtime stdlib logic is unchanged; annotations are cfg(kani) / contract attributes.

Slice iterator next/next_back and related unsafe.

Validation

  • Local worktree on challenge/18-slice-iter
  • Kani CI on this PR is the authoritative run (scripts/run-kani.sh)

Fixes#282

AI/LLM disclosure

  • AI coding tools (including Grok and/or Codex agent-assisted editing) were used to help draft or modify code and this PR description.
  • I reviewed the complete change, understand the reasoning, and take responsibility for the contracts and harnesses.
  • This submission is original work of authorship under the project contributor terms; AI output was not pasted unreviewed.

Kani contracts and harnesses for verify-rust-std challenge.
Fixesrust-lang#282
@sankalpsthakur
sankalpsthakur requested a review from a team as a code ownerAugust 20, 2026 12:08
`$($extra)*}` in slice/iter/macros.rs was unparseable, so rustfmt, Flux,
GOTO, Kani partitions, and autoharness all failed at compile.
Drop Iter/IterMut loop contracts and huge-array copies of new
harnesses that shifted ffi::c_str::verify::check_from_ptr_contract
into partition 3 and made CBMC's builtin strlen fail
("len is assignable"). Runtime iterator bodies unchanged.
macros.rs braces stay matched.
proof_for_contract fails the single top-level call check on
slice::iter::verify::verify_iter_mut_char::check_post_inc_start
(char/UTF-8 pulls extra calls). Keep the std contract; that
one harness is #[kani::proof] under offset <= len.
@feliperodrifeliperodri added the Challenge Used to tag a challenge label Aug 20, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ChallengeUsed to tag a challenge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Challenge 18: Verify the safety of slice iter functions - part 1

2 participants

@sankalpsthakur@feliperodri