Skip to content

Challenge 29: restore the contract on Box<MaybeUninit<T>>::assume_init - #795

Open
sankalpsthakur wants to merge 1 commit into
model-checking:mainfrom
sankalpsthakur:ch29-restore-assume-init-contract
Open

sankalpsthakur wants to merge 1 commit into
model-checking:mainfrom
sankalpsthakur:ch29-restore-assume-init-contract

Conversation

@sankalpsthakur

Copy link
Copy Markdown

item 1 from @feliperodri's comment on #526 after #639 merged: restore the contract on the sized Box<MaybeUninit<T>>::assume_init

model-checking/kani#4984 is fixed by model-checking/kani#4985, and main's current Kani pin (9834c96, from #784) includes it, so the contract can go back on the const fn

what changed

  • library/alloc/src/boxed.rs: drop the kani#4984 TODO and attach the requires/ensures that were commented out under it, unchanged
  • replace the assume_init_mirror helper and its three #[kani::proof] harnesses with #[kani::proof_for_contract(Box::<core::mem::MaybeUninit<T>, A>::assume_init)] harnesses for i32, bool and (), same names (check_assume_init_{i32,bool,zst}) and the same cover_reached() witness as the other contract harnesses in mod verify
  • runtime code is unchanged

validation

not run locally, PR CI runs the harnesses with the pinned Kani

part of #526. the challenge stays open until items 2 (-Z valid-value-checks in CI) and 3 (the ruling in #733) are done and the resolve PR lands

i used an ai coding assistant to help write this change and reviewed it myself

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

kani#4984 is fixed by kani#4985, which the pinned Kani includes, so the sized
assume_init can carry its requires/ensures again. Replace the
assume_init_mirror proofs with proof_for_contract harnesses for i32, bool
and ().
@sankalpsthakur
sankalpsthakur requested a review from a team as a code owner November 25, 2026 16:49
@feliperodri feliperodri added the Maintenance Maintenance related issues for the challange label Nov 25, 2026

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

Maintenance Maintenance related issues for the challange

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants