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 Slice::partition_dedup_by #130

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

Conversation

qinheping
Copy link

We need to avoid having free be removed as unused function. This is because DFCC contract enforcement assumes that a definition for free exists. However, we cannot simply call free by adding let _ = Box::new(10);. We need an alternative workaround for the issue.

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 requested a review from a team as a code owner October 22, 2024 16:02
@celinval
Copy link

We need to update Kani's branch to use loop-invariants. @carolynzech, can you please take a look?

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.

Awesome! Thanks

pub mod verify {
use super::*;

pub fn any_slice_of_array<T, const LENGTH: usize>(arr: &[T; LENGTH]) -> &[T] {

Choose a reason for hiding this comment

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

Do you need this one?

library/core/src/slice/mod.rs Show resolved Hide resolved

#[kani::proof]
pub fn check_partition_dedup_by() {
const ARR_SIZE: usize = 1000;

Choose a reason for hiding this comment

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

nice!

@celinval
Copy link

celinval commented Oct 22, 2024

We need to avoid having free be removed as unused function. This is because DFCC contract enforcement assumes that a definition for free exists. However, we cannot simply call free by adding let _ = Box::new(10);. We need an alternative workaround for the issue.

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

For function contracts, we currently have a workaround. We invoke init_contracts() function here which basically invokes free(0) which is a no-op.

That said, why does DFCC have that requirement? Can we remove that instead?

@qinheping qinheping marked this pull request as draft November 7, 2024 19:07
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