Repository navigation
Contracts & Harnesses for len, is_empty, is_aligned, and is_aligned_to - #128
Conversation
celinval
left a comment
There was a problem hiding this comment.
Awesome! I just have a few high level comments:
- Can you please use
safety::ensuresandsafety::requiresinstead ofkaniones? - Can you also check the tests with dangling pointers? For example, you could use
PointerGenerator, or multiple harnesses.
@Jimmycreative See pointer generator documentation here: https://model-checking.github.io/kani/crates/doc/kani/struct.PointerGenerator.html |
celinval
left a comment
There was a problem hiding this comment.
It looks good. Can you please ensure that calling is_aligned_to with a invalid alignment value (not power of two) will not trigger UB. One way you could do that is to write a regular harness, i.e., a #[kani::proof] instead of #[kani::proof_for_contract(<func>)] so Kani does not assume the pre-condition. If the harness fails due to panic, you can add a #[kani::should_panic] to the harness.
carolynzech
left a comment
There was a problem hiding this comment.
Nice job! Once you fix the conflicts, please @ me so that I can trigger the merge workflow.
Co-authored-by: Carolyn Zech <[email protected]>
Towards #53
Changes
added contract and harness for len, is_empty, is_aligned, and is_aligned_to in the non-null library.