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 reference for loop contracts #3849

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

qinheping
Copy link
Contributor

This PR adds reference of loop contracts:
Rendered version: https://github.com/qinheping/kani/blob/docs/loop-contracts/docs/src/reference/experimental/loop-contracts.md

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 January 23, 2025 22:15
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!

docs/src/reference/experimental/loop-contracts.md Outdated Show resolved Hide resolved
docs/src/reference/experimental/loop-contracts.md Outdated Show resolved Hide resolved
docs/src/reference/experimental/loop-contracts.md Outdated Show resolved Hide resolved
docs/src/reference/experimental/loop-contracts.md Outdated Show resolved Hide resolved
docs/src/reference/experimental/loop-contracts.md Outdated Show resolved Hide resolved
docs/src/reference/experimental/loop-contracts.md Outdated Show resolved Hide resolved
docs/src/reference/experimental/loop-contracts.md Outdated Show resolved Hide resolved
docs/src/reference/experimental/loop-contracts.md Outdated Show resolved Hide resolved
docs/src/reference/experimental/loop-contracts.md Outdated Show resolved Hide resolved
docs/src/reference/experimental/loop-contracts.md Outdated Show resolved Hide resolved
@feliperodri feliperodri added [C] Documentation Additions and improvements to our documentation Z-Contracts Issue related to code contracts labels Jan 26, 2025
@qinheping
Copy link
Contributor Author

@zhassan-aws , thank you for the feedbacks! I addressed the comments above.

@@ -29,6 +29,9 @@ Kani needs to unwind the loop for `u64::MAX` iterations, which is computationall
With loop contracts, we can specify the loop’s behavior using invariants. For example:

``` Rust
#![feature(stmt_expr_attributes)]
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these necessary to include here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is necessary for use attribute on stmt_expr like loops.

docs/src/reference/experimental/loop-contracts.md Outdated Show resolved Hide resolved
docs/src/reference/experimental/loop-contracts.md Outdated Show resolved Hide resolved
docs/src/reference/experimental/loop-contracts.md Outdated Show resolved Hide resolved
@qinheping qinheping enabled auto-merge January 29, 2025 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C] Documentation Additions and improvements to our documentation Z-Contracts Issue related to code contracts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants