Skip to content
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

Cannot find macro __kani__workaround_core_assert #2842

Open
weaversa opened this issue Oct 26, 2023 · 3 comments
Open

Cannot find macro __kani__workaround_core_assert #2842

weaversa opened this issue Oct 26, 2023 · 3 comments
Labels
[C] Bug This is a bug. Something isn't working.

Comments

@weaversa
Copy link

I'm running cargo kani version 0.39.0 in a project that has a dependency (apparently) on theunicode-bidi package. The error I get during cargo kani compilation is:

...
Compiling unicode-bidi v0.3.13
error: cannot find macro `__kani__workaround_core_assert` in this scope
   --> .cargo/registry/src/index.crates.io/unicode-bidi-0.3.13/src/implicit.rs:494:13
    |
494 | / ...   std::debug_assert!(
495 | | ...       false,
496 | | ...       "Found broken indices in level run: found indices {}.....
497 | | ...       level_run.start,
498 | | ...       level_run.end,
499 | | ...       text.len()
500 | | ...   );
    | |_______^
    |
    = note: this error originates in the macro `$crate::assert` which comes from the expansion of the macro `std::debug_assert` (in Nightly builds, run\
 with -Z macro-backtrace for more info)

Any assistance would be appreciated.

@weaversa weaversa added the [C] Bug This is a bug. Something isn't working. label Oct 26, 2023
@zhassan-aws
Copy link
Contributor

Thanks for reporting the issue @weaversa. This is a duplicate of #2187. We've attempted a fix in #2194, but unfortunately, this broke other things.

Unfortunately, there is no easy fix as we need to change the mechanism by which Kani overrides std macros (tracked by #2275).

You can try editing ~/.kani/kani-0.39.0/library/std/src/lib.rs and apply the same patch that was applied in #2194. I'm not sure if doing that will work though.

@weaversa
Copy link
Author

Thanks for reporting the issue @weaversa. This is a duplicate of #2187. We've attempted a fix in #2194, but unfortunately, this broke other things.

Unfortunately, there is no easy fix as we need to change the mechanism by which Kani overrides std macros (tracked by #2275).

You can try editing ~/.kani/kani-0.39.0/library/std/src/lib.rs and apply the same patch that was applied in #2194. I'm not sure if doing that will work though.

Thank you for looking into it. I'll track #2275. Is there some way to use your newish stubbing capability here? I gather not since the issue happens during initial compilation.

@zhassan-aws
Copy link
Contributor

I gather not since the issue happens during initial compilation.

Correct: the issue happens during expansion of the debug_assert macro, so stubbing won't help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C] Bug This is a bug. Something isn't working.
Projects
None yet
Development

No branches or pull requests

2 participants