-
Notifications
You must be signed in to change notification settings - Fork 31
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 BinaryHeap::sift_up
#129
base: main
Are you sure you want to change the base?
Conversation
BinaryHeap::sift_up
Would adding a |
unsafe fn sift_up(&mut self, start: usize, pos: usize) -> usize { | ||
// Take out the value at `pos` and create a hole. | ||
// SAFETY: The caller guarantees that pos < self.len() | ||
let mut hole = unsafe { Hole::new(&mut self.data, pos) }; | ||
|
||
#[cfg_attr(kani, kani::loop_invariant(hole.pos() <= pos))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please loop invariants to the safety
crate for now and use that instead?
This proof is blocked as CBMC couldn't infer the loop modifies
hole.pos
. We need to add support of loop modifies or improve CBMC's inference algorithm.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.