Repository navigation
Commit 525414a
authored
Challenge 29: Kani contracts for Box, convert, and ThinBox (#639)
Resolves #526 (Challenge 29: Box, convert and ThinBox).
Add safety contracts and Kani harnesses using the repository's
`safety::{requires, ensures}` annotations. Runtime stdlib logic is
unchanged.
Coverage includes assume-init methods, raw/non-null reconstructors,
ThinBox operations, slice constructors, downcast paths and pinning.
Slice harnesses use bounded symbolic lengths. Reconstructor contracts
check dereferenceability and layout bounds; allocator provenance remains
a caller obligation that these contracts cannot express.
The challenge's unchecked `dyn Error` methods do not exist in this tree.
The actual `Box<dyn Any>` `downcast_unchecked` variants carry contracts
and are proved with `proof_for_contract`, which needs
model-checking/kani#4778 (in the pinned Kani). The listed
`TryFrom<Box<T>>` implementation also does not exist; `TryFrom<Vec<T>>`
is covered separately.
### Validation
On the current head `4712f513d5`, all 27 completed GitHub checks pass (2
skipped). The earlier run 32560286046 at `4da62f00d5` reported 1,447
(Ubuntu) and 1,446 (macOS) verified autoharness harnesses with zero
failures. These are run-level results, not counts of new harnesses in
this PR.
AI coding tools assisted with the contracts, harnesses and this
description.
By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 and MIT licenses.1 parent d6775ff commit 525414a
3 files changed
Lines changed: 856 additions & 0 deletions
0 commit comments