-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Emit an error when proof_for_contract function is not found (#3609)
Currently, Kani panics if the function specified in the `proof_for_contract` attribute is not found (e.g. because the function is not reachable) (see #3467). This PR adds an error message pointing out the issue. Towards #3467 By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.
- Loading branch information
1 parent
00c648d
commit dcb4d6d
Showing
4 changed files
with
46 additions
and
3 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
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,6 @@ | ||
error: The function specified in the `proof_for_contract` attribute, `foo`, was not found.\ | ||
Make sure the function is reachable from the harness. | ||
test.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,14 @@ | ||
// Copyright Kani Contributors | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
// kani-flags: -Zfunction-contracts | ||
|
||
// This test checks Kani's error when function specified in `proof_for_contract` | ||
// harness is not found (e.g. because it's not reachable from the harness) | ||
|
||
#[kani::requires(true)] | ||
fn foo() {} | ||
|
||
#[kani::proof_for_contract(foo)] | ||
fn check_foo() { | ||
assert!(true); | ||
} |