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

Generate contracts of dependencies as assertions #3802

Merged
merged 19 commits into from
Jan 9, 2025

Conversation

carolynzech
Copy link
Contributor

@carolynzech carolynzech commented Dec 30, 2024

Generates contract clauses of dependencies as assertions, with an option --no-assert-contracts to disable it. This works by adding a new contract mode that outputs the original body of the function with its contract clauses asserted. During the FunctionWithContractPass, we use this closure, unless --no-assert-contracts was passed, in which case we use the regular body.

I'm omitting a description of why this is useful from the PR description--there's one in the module documentation, and I want that to be a self-contained explanation (i.e., if something is unclear, I want to fix it there).

(Also did a minor bit of cleanup, renaming ClosureType to ContractMode and moving split_for_remembers to the shared module since it has contract-specific logic.)

Resolves #3326

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

@github-actions github-actions bot added the Z-BenchCI Tag a PR to run benchmark CI label Dec 30, 2024
@carolynzech carolynzech marked this pull request as ready for review January 2, 2025 17:58
@carolynzech carolynzech requested a review from a team as a code owner January 2, 2025 17:58
Copy link
Contributor

@zhassan-aws zhassan-aws left a comment

Choose a reason for hiding this comment

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

Nice, thanks!

Only a few comments.

kani-compiler/src/args.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@zhassan-aws zhassan-aws left a comment

Choose a reason for hiding this comment

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

Thanks!

@carolynzech carolynzech enabled auto-merge January 8, 2025 21:39
@carolynzech carolynzech changed the title Add an option to generate contracts as assertions Generate contracts of dependencies as assertions Jan 9, 2025
@carolynzech carolynzech added this pull request to the merge queue Jan 9, 2025
Merged via the queue into model-checking:main with commit addc590 Jan 9, 2025
28 checks passed
@carolynzech carolynzech deleted the contracts-as-assertions branch January 9, 2025 03:42
github-merge-queue bot pushed a commit that referenced this pull request Jan 11, 2025
## What's Changed
* Package Docker release step: ensure compiler is installed by
@tautschnig in #3789
* Improve `--jobs` UI by @carolynzech in
#3790
* Update kissat to v4.0.1 by @remi-delmas-3000 in
#3791
* Automatic cargo update to 2024-12-23 by @github-actions in
#3792
* Bump tests/perf/s2n-quic from `0b3f892` to `a54686e` by @dependabot in
#3793
* Upgrade toolchain to nightly-2024-12-18 by @zhassan-aws in
#3794
* Automatic cargo update to 2024-12-30 by @github-actions in
#3800
* fix: clippy by @ShoyuVanilla in
#3806
* Update dependencies (02.01.2025). by @remi-delmas-3000 in
#3809
* Update charon submodule by @zhassan-aws in
#3801
* Upgrade toolchain to 2024-12-19 by @zhassan-aws in
#3810
* Automatic cargo update to 2025-01-06 by @github-actions in
#3812
* Bump tests/perf/s2n-quic from `a54686e` to `ac52a48` by @dependabot in
#3813
* Generate contracts of dependencies as assertions by @carolynzech in
#3802
* Fix hanging command in `std-analysis.sh` by @carolynzech in
#3818
* Add UB checks for ptr_offset_from* intrinsics by @celinval in
#3757
* Toolchain update 06-01-2025 by @remi-delmas-3000 in
#3814
* Automatic toolchain upgrade to nightly-2025-01-07 by @github-actions
in #3820
* Include manifest-path when checking if packages are in the workspace
by @qinheping in #3819

## New Contributors
* @ShoyuVanilla made their first contribution in
#3806

**Full Changelog**:
kani-0.57.0...kani-0.58.0

---------

Co-authored-by: Celina G. Val <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Z-BenchCI Tag a PR to run benchmark CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add an option to turn contract clauses into assertions
3 participants