generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 136
Fail verification if contract is vacuous #3623
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
Closed
Closed
Changes from 3 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8535773
fail verification if contract preconditions are unsat
2a3f838
fix tests
5b0e501
Merge branch 'main' into contract-vacuity
724ffe9
simplify condition
5a23e53
contract_cover
d21019b
Merge branch 'main' into contract-vacuity
0e5d7aa
Update library/kani_macros/src/sysroot/contracts/mod.rs
bdc574b
Merge branch 'main' into contract-vacuity
1301123
only fail for undetermined if there are unwinding failures; fix docs
7770e3f
docs
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
tests/expected/function-contract/vacuous_requires_fail.expected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| Failed Checks: The contract's precondition (i.e., the conjunction of the #[requires(...)] clauses' bodies) is satisfiable. | ||
|
|
||
| VERIFICATION:- FAILED | ||
|
|
||
| Verification failed for - prove_buggy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| // Copyright Kani Contributors | ||
| // SPDX-License-Identifier: Apache-2.0 OR MIT | ||
| // kani-flags: -Zfunction-contracts | ||
|
|
||
| // See https://github.com/model-checking/kani/issues/2793 | ||
| #[kani::requires(a > 5)] | ||
| #[kani::requires(a < 4)] | ||
| #[kani::ensures(|result| *result == a)] | ||
| fn buggy(a: u32) -> u32 { | ||
| panic!("This code is never tested") | ||
| } | ||
|
|
||
| #[kani::proof_for_contract(buggy)] | ||
| fn prove_buggy() { | ||
| let x: u32 = kani::any(); | ||
| buggy(x); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,17 @@ | ||
| Checking harness pre_condition::harness_invalid_ptr... | ||
| VERIFICATION:- SUCCESSFUL (encountered one or more panics as expected) | ||
| assume_unless_vacuous\ | ||
| - Status: FAILURE | ||
| VERIFICATION:- FAILED (encountered failures other than panics, which were unexpected) | ||
|
|
||
| Checking harness pre_condition::harness_stack_ptr... | ||
| VERIFICATION:- SUCCESSFUL | ||
|
|
||
| Checking harness pre_condition::harness_head_ptr... | ||
| VERIFICATION:- SUCCESSFUL | ||
|
|
||
| Complete - 3 successfully verified harnesses, 0 failures, 3 total | ||
| Checking harness post_condition::harness... | ||
| assume_unless_vacuous\ | ||
| - Status: FAILURE | ||
| VERIFICATION:- FAILED (encountered failures other than panics, which were unexpected) | ||
|
|
||
| Complete - 2 successfully verified harnesses, 2 failures, 4 total |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.