-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
52273cb
commit ea33b42
Showing
2 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
tests/ui/attr-invariant/double-attr-invariant/double-attr-invariant.rs
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 @@ | ||
// Copyright Kani Contributors | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
||
//! Check that there is a compilation error when the predicate passed to | ||
//! `kani::invariant` attribute would result in a compiler error. | ||
|
||
extern crate kani; | ||
use kani::Invariant; | ||
|
||
// Note: The struct fields `x` and `y` are references in this context, we should | ||
// refer to `*x` and `*y` instead. | ||
#[kani::invariant(*x >= 0)] | ||
#[kani::invariant(*y >= 0)] | ||
struct Point { | ||
x: i32, | ||
y: i32, | ||
} |
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[E0119]: conflicting implementations of trait `kani::Invariant` for type `Point` | ||
| | ||
12 | #[kani::invariant(*x >= 0)] | ||
| --------------------------- first implementation here | ||
13 | #[kani::invariant(*y >= 0)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Point` |