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.
Fix std overrides when crate has extern std (model-checking#2989)
I tried applying model-checking#2983 fix, however, this would require user to import `__kani_workaround_core_assert`. To fix that, I moved the definition to be under `kani` crate. I replaced the existing fixme test. Initially I didn't check we had one, and I created a second one which is simpler (no cargo needed) but that also includes other cases. Resolves model-checking#2187
- Loading branch information
Showing
7 changed files
with
48 additions
and
48 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,15 @@ | ||
Checking harness foo... | ||
|
||
Status: SUCCESS\ | ||
Description: ""debug_assert""\ | ||
macro_override.rs: | ||
|
||
Status: SUCCESS\ | ||
Description: "panic"\ | ||
macro_override.rs: | ||
|
||
Status: SUCCESS\ | ||
Description: "internal error: entered unreachable code: unreachable"\ | ||
macro_override.rs: | ||
|
||
Complete - 1 successfully verified harnesses, 0 failures, 1 total. |
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,22 @@ | ||
// Copyright Kani Contributors | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
||
//! Test if Kani can correctly identify assertions in a no_std crate that re-exports `std` library. | ||
//! Issue previously reported here: <https://github.com/model-checking/kani/issues/2187> | ||
// | ||
// compile-flags: --cfg=feature="std" | ||
#![no_std] | ||
|
||
#[cfg(feature = "std")] | ||
extern crate std; | ||
|
||
#[kani::proof] | ||
fn foo() { | ||
std::debug_assert!(true, "debug_assert"); | ||
if kani::any_where(|b| !b) { | ||
std::unreachable!("unreachable") | ||
} | ||
if kani::any_where(|val: &u8| *val > 10) < 10 { | ||
std::panic!("panic") | ||
} | ||
} |