Skip to content

Kani assert override is more restrictive than standard assert #2108

@tedinski

Description

@tedinski

This code works as a test but fails with Kani:

#[cfg_attr(test, test)]
#[cfg_attr(kani, kani::proof)]
fn check() {
    let v: bool = true;
    assert!(&v);
}

With test: builds successfully, no warnings/errors, test passes.

With kani:

error[E0308]: mismatched types
  --> test_bool_ref.rs:7:13
   |
7  |     assert!(&v);
   |     --------^^-
   |     |       |
   |     |       expected `bool`, found `&bool`
   |     arguments to this function are incorrect
   |
note: function defined here
  --> /home/ubuntu/rmc/library/kani/src/lib.rs:62:14
   |
62 | pub const fn assert(_cond: bool, _msg: &'static str) {
   |              ^^^^^^

Metadata

Metadata

Assignees

No one assigned

    Labels

    [C] BugThis is a bug. Something isn't working.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions