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

Function Contracts: Modify Slices #3289

Closed
wants to merge 9 commits into from
Closed

Conversation

pi314mm
Copy link
Contributor

@pi314mm pi314mm commented Jun 24, 2024

Using the __CPROVER_object_upto function to pass modifies clauses to asserts clauses in goto for rust slices.

Adds new functionality of a new contract kani:modifies_slice(slice) that allows for indicating if a slice is modifiable.

Todo:

  • Allow for all sized data. Currently only working for bytesize slice data because __CPROVER_object_upto takes a size parameter in number of bytes
  • Testing and documentation

Resolves #2908

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

@pi314mm pi314mm added the [C] Feature / Enhancement A new feature request or enhancement to an existing feature. label Jun 24, 2024
@pi314mm pi314mm added this to the Function Contracts milestone Jun 24, 2024
@pi314mm pi314mm self-assigned this Jun 24, 2024
@github-actions github-actions bot added the Z-BenchCI Tag a PR to run benchmark CI label Jun 24, 2024
@celinval
Copy link
Contributor

Can the compiler detect the pointer type and do that optimization under the hood?

}

#[kani::proof_for_contract(zero)]
fn main() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a meaningful name to the harness instead of main.

@pi314mm
Copy link
Contributor Author

pi314mm commented Jun 25, 2024

Closing for different implementation that doesn't create a new modifies_slices contract but uses just one modifies contract. It was useful to prototype this implementation to understand how the two differ so that they can be joined together.

@pi314mm pi314mm closed this Jun 25, 2024
@pi314mm pi314mm deleted the slices branch July 18, 2024 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C] Feature / Enhancement A new feature request or enhancement to an existing feature. Z-BenchCI Tag a PR to run benchmark CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for slices in modifies clauses
2 participants