Skip to content

Challenge 29: Verify safety of Box functions#573

Open
Samuelsills wants to merge 2 commits intomodel-checking:mainfrom
Samuelsills:challenge-29-box
Open

Challenge 29: Verify safety of Box functions#573
Samuelsills wants to merge 2 commits intomodel-checking:mainfrom
Samuelsills:challenge-29-box

Conversation

@Samuelsills
Copy link

Summary

Add Kani proof harnesses for Box functions specified in Challenge #29:

Unsafe (9/9 — all required):

  • assume_init (single + slice), from_raw, from_non_null, from_raw_in, from_non_null_in, downcast_unchecked (Any, Any+Send, Any+Send+Sync)

Safe (34/43 — 79%, exceeds 75% threshold):

  • Allocation: new_in, try_new_in, try_new_uninit_in, try_new_zeroed_in
  • Slices: new_uninit_slice, new_zeroed_slice, try_new_uninit_slice, try_new_zeroed_slice, into_array
  • Conversion: into_boxed_slice, write, into_non_null, into_raw_with_allocator, into_non_null_with_allocator, into_unique, leak, into_pin
  • Traits: drop, default (i32, str), clone (T, str), from_slice, from (&str), from (Box->Box<[u8]>), try_from (slice->array)
  • Downcasting: downcast (Any x3, Error x3)

All harnesses verified locally with Kani.

Resolves #526

Samuelsills and others added 2 commits March 26, 2026 23:28
Add Kani proof harnesses for Box functions specified in Challenge model-checking#29:
9 unsafe functions (assume_init, from_raw, from_non_null, from_raw_in,
from_non_null_in, downcast_unchecked x3) and 34 safe functions covering
allocation, conversion, cloning, downcasting, and trait implementations.
Exceeds the 75% safe function threshold (34/43 = 79%).
Resolves model-checking#526

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Samuelsills Samuelsills marked this pull request as ready for review March 27, 2026 08:30
@Samuelsills Samuelsills requested a review from a team as a code owner March 27, 2026 08:30
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.

Challenge 29: Safety of boxed

1 participant