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.
Filter sanity checks (model-checking#1146)
Properties which are sanity checks needed to be removed from the UI. They are now marked with the property_class "sanity_check" which makes it easy to filter such checks out as the pipeline to add, remove and edit checks based on their property_class has already been setup.
- Loading branch information
Showing
3 changed files
with
55 additions
and
1 deletion.
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,3 @@ | ||
sanity_check.1\ | ||
Status: FAILURE\ | ||
Description: "Reached assignment statement with unequal types Pointer { typ: StructTag("tag-Unit") } StructTag("tag-Unit")" |
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,38 @@ | ||
// Copyright Kani Contributors | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
||
/// This testcase is currently failing with the following error: | ||
/// | ||
/// [assertion.2] Reached assignment statement with unequal types Pointer { typ: | ||
/// StructTag("tag-Unit") } Pointer { typ: StructTag("tag-_3943305294634710273") }: FAILURE | ||
/// | ||
/// If you run: | ||
/// ``` | ||
/// RUSTFLAGS="--cfg=ok" kani fixme_niche_opt.rs | ||
/// ``` | ||
/// This test will succeed. | ||
/// | ||
/// Issue: https://github.com/model-checking/kani/issues/729 | ||
enum Error { | ||
Error1, | ||
Error2, | ||
} | ||
|
||
/// This version fails. | ||
#[cfg(not(ok))] | ||
fn to_option<T: Copy, E>(result: &Result<T, E>) -> Option<T> { | ||
if let Ok(v) = result { Some(*v) } else { None } | ||
} | ||
|
||
/// This version succeeds. | ||
#[cfg(ok)] | ||
fn to_option<T: Copy, E>(result: &Result<T, E>) -> Option<T> { | ||
if let Ok(v) = *result { Some(v) } else { None } | ||
} | ||
|
||
#[kani::proof] | ||
fn main() { | ||
let result: Result<(), Error> = Ok(()); | ||
assert!(to_option(&result).is_some()); | ||
} |