forked from model-checking/kani
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More error handling, improve UI testing
- Loading branch information
1 parent
0ed1f23
commit 180105c
Showing
7 changed files
with
41 additions
and
9 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions
5
.../invalid-pred-error/invalid-pred-error.rs → .../invalid-pred-error/invalid-pred-error.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
6 changes: 6 additions & 0 deletions
6
tests/ui/safety-constraint-attribute/no-struct-error/expected
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: Cannot derive `Invariant` for `MyEnum` | ||
| | ||
| #[derive(kani::Invariant)] | ||
| ^^^^^^^^^^^^^^^ | ||
| | ||
note: `#[safety_constraint(...)]` can only be used in structs |
18 changes: 18 additions & 0 deletions
18
tests/ui/safety-constraint-attribute/no-struct-error/no-struct-error.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,18 @@ | ||
// Copyright Kani Contributors | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
||
//! Check that Kani raises an error when a derive macro with the | ||
//! `#[safety_constraint(...)]` attribute is is used in items which are not a | ||
//! struct. | ||
//! | ||
//! Note: the `#[derive(kani::Invariant)]` macro is required for the compiler error, | ||
//! otherwise the `#[safety_constraint(...)]` attribute is ignored. | ||
extern crate kani; | ||
|
||
#[derive(kani::Invariant)] | ||
#[safety_constraint(true)] | ||
enum MyEnum { | ||
A, | ||
B(i32), | ||
} |