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

Add loop contracts and harness for ptr::swap_nonoverlapping_simple_untyped #152

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

Conversation

qinheping
Copy link

Add loop contracts and a proof harness for swap_nonoverlapping_simple_untyped.

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

@qinheping qinheping marked this pull request as ready for review November 8, 2024 07:18
@qinheping qinheping requested a review from a team as a code owner November 8, 2024 07:18
@qinheping
Copy link
Author

The loop contracts is strong enough to prove the safety of all harness. However, in the failed harnesses check_typed_swap_u8, check_typed_swap_char, and check_typed_swap_non_zero, we also want to prove the swap actually happened beyond just safety, which requires a stronger loop invariants and loop_old to refer historic values in loop contracts.

Copy link

@celinval celinval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add a safety contract to swap_nonoverlapping_simple_untyped and verify that it is enough to guarantee safety?

@@ -230,6 +230,7 @@
#![feature(unboxed_closures)]
#![feature(unsized_fn_params)]
#![feature(with_negative_coherence)]
#![feature(proc_macro_hygiene)]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#![feature(proc_macro_hygiene)]
#![cfg_attr(kani, feature(proc_macro_hygiene))]

@qinheping qinheping marked this pull request as draft November 13, 2024 22:21
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.

2 participants