-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
call check_proof_attribute for contract harnesses
- Loading branch information
1 parent
dba8f39
commit 80a4914
Showing
5 changed files
with
65 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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 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 @@ | ||
error: only one '#[kani::proof_for_contract]' attribute is allowed per harness\ | ||
invalid.rs:\ | ||
|\ | ||
| #[kani::proof_for_contract(foo)]\ | ||
| ^^^^^^^^^^^^^^ | ||
|
||
error: functions used as harnesses cannot have any arguments\ | ||
invalid.rs:\ | ||
|\ | ||
| #[kani::proof_for_contract(foo)] | ||
| ^^^^^^^^^^^^^^ | ||
|
||
error: the '#[kani::proof_for_contract]' attribute cannot be applied to generic functions\ | ||
invalid.rs:\ | ||
|\ | ||
| #[kani::proof_for_contract(foo)]\ | ||
| ^^^^^^^^^^^^^^ |
This file contains 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,25 @@ | ||
// Copyright Kani Contributors | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
// kani-flags: -Zfunction-contracts | ||
|
||
// This test is to check Kani's error handling of invalid usages of the `proof_for_contract` harness. | ||
// We also ensure that all errors and warnings are printed in one compilation. | ||
|
||
#[kani::requires(true)] | ||
fn foo() {} | ||
|
||
#[kani::proof_for_contract(foo)] | ||
#[kani::proof_for_contract(foo)] | ||
fn multiple_proof_annotations() { | ||
foo(); | ||
} | ||
|
||
#[kani::proof_for_contract(foo)] | ||
fn proof_with_arg(arg: bool) { | ||
foo(); | ||
} | ||
|
||
#[kani::proof_for_contract(foo)] | ||
fn generic_harness<T: Default>() { | ||
foo(); | ||
} |
This file contains 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 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 +1 @@ | ||
error: the `proof` attribute cannot be applied to generic functions | ||
error: the '#[kani::proof]' attribute cannot be applied to generic functions |