Skip to content

Cannot find assert in core compile error #1984

Closed

Description

@zhassan-aws

Steps to reproduce:

  1. cargo new hdrhistogram_dep
  2. cd hdrhistogram_dep
  3. cargo add hdrhistogram

using the following command line invocation:

cargo kani

with Kani version: 94b4e84

I expected to see this happen: No proof harnesses (functions with #[kani::proof]) were found to verify.

Instead, this happened:

$ cargo kani
   Compiling cfg-if v1.0.0
   Compiling memchr v2.5.0
   Compiling autocfg v1.1.0
   Compiling crc32fast v1.3.2
   Compiling crossbeam-utils v0.8.14
   Compiling adler v1.0.2
   Compiling minimal-lexical v0.2.1
   Compiling base64 v0.13.1
   Compiling byteorder v1.4.3
   Compiling miniz_oxide v0.6.2
   Compiling num-traits v0.2.15
   Compiling nom v7.1.1
   Compiling flate2 v1.0.25
   Compiling crossbeam-channel v0.5.6
   Compiling hdrhistogram v7.5.2
error[E0433]: failed to resolve: could not find `assert` in `core`
   --> /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/hdrhistogram-7.5.2/src/lib.rs:628:25
    |
628 |                         panic!("Tried to subtract value outside of range: {}", other_value);
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ could not find `assert` in `core`
    |
    = note: this error originates in the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0433]: failed to resolve: could not find `assert` in `core`
    --> /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/hdrhistogram-7.5.2/src/lib.rs:1649:9
     |
1649 | /         assert!(
1650 | |             high >= 2 * self.lowest_discernible_value,
1651 | |             "highest trackable value must be >= (2 * lowest discernible value)"
1652 | |         );
     | |_________^ could not find `assert` in `core`
     |
     = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0433`.
Error: "Failed to compile crate."
error: could not compile `hdrhistogram` due to 2 previous errors
Error: cargo exited with status exit status: 101

Activity

  1. added
    [C] Bug
    on Dec 12, 2022
  2. self-assigned this
    on Dec 12, 2022
  3. zhassan-aws commented on Dec 12, 2022

    @zhassan-aws
    ContributorAuthor

    Here is a minimal reproducer:

    mod core {
    }
    
    #[kani::proof]
    fn main() {
        if kani::any() {
            let x = 5;
            panic!("x is {}", x);
        }
    }
    $ kani mod_core.rs 
    error[E0433]: failed to resolve: could not find `assert` in `core`
     --> mod_core.rs:8:9
      |
    8 |         panic!("x is {}", x);
      |         ^^^^^^^^^^^^^^^^^^^^ could not find `assert` in `core`
      |
      = note: this error originates in the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
    
    error: aborting due to previous error
    
    For more information about this error, try `rustc --explain E0433`.
    Error: "Failed to compile crate."
    Error: /home/ubuntu/git/kani/target/kani/bin/kani-compiler exited with status exit status: 1
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

[C] Bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions