-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue finding debug_assert
in no_std
crates when std enabled
#2187
Comments
Thanks for the bug report @cameron1024. This is likely due to how we re-export the standard library to allow us to override certain macros https://github.com/model-checking/kani/blob/main/library/std/src/lib.rs We are investigating. |
Thanks for looking into it, love the project 😊 |
Re-opening as the fix has been reverted due to the issues it caused. |
This also affects the harness in lading (DataDog) if one runs |
I tried applying #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 #2187
I tried this code:
using the following command line invocation:
with Kani version: 0.20.0
I expected to see this happen: verification should succeed
Instead, this happened:
I get an error:
I initially ran into this while trying to compile a transitive dependency:
unicode-bidi
, which has a similar snippet (it's found at: https://github.com/servo/unicode-bidi/blob/master/src/implicit.rs#L494).All of the following make the bug disappear:
#![no_std]
extern crate std
std::
fromstd::debug_assert!(...)
"text"
fromstd::debug_assert!(true, "text")
All of the following have no effect:
#[cfg(feature = "std")]
to the debug assert#[cfg(kani)]
tofn foo()
#[kani::proof]
tofn foo()
std::debug_assert!(false, "text");
I've tried to reduce it further, but it's pretty bare at this point.
The key ingredients seem to be:
extern crate std;
gated by a feature flagstd::debug_assert!
I can't tell if this is caused by user error, or if there's a workaround I can use to verify my program even in the presence of this. I'm quite new to using kani, and am evaluating it for use at work, so apologies if there's some docs that explains this 😅
Thanks in advance 😁
The text was updated successfully, but these errors were encountered: