Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contracts & Harnesses for f32::to_int_unchecked #134

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Yenyun035
Copy link

@Yenyun035 Yenyun035 commented Oct 24, 2024

Towards #59
❗ Depends on this WIP Kani Issue, as discussed in this thread in #59

Changes

  • Added contracts for f32::to_int_unchecked (located in library/core/src/num/f32.rs)
  • Added a macro for generating to_int_unchecked harnesses
  • Added harnesses for to_int_unchecked of each integer type
    • i8, i16, i32, i64, i128, isize, u8, u16, u32, u64, u128, usize --- 12 harnesses in total.

Revalidation

  1. Per the discussion in Challenge 11: Safety of Methods for Numeric Primitive Types #59, we have to build and run Kani from feature/verify-rust-std branch.
  2. To revalidate the verification results, run the following command. <harness_to_run> can be either num::verify to run all harnesses or num::verify::<harness_name> (e.g. checked_f32_to_int_unchecked_i8) to run a specific harness.
kani verify-std  "path/to/library" \
    --harness <harness_to_run> \
    -Z unstable-options \
    -Z function-contracts \
    -Z mem-predicates

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

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.

1 participant