File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -44,10 +44,11 @@ pub mod process;
44
44
#[ macro_export]
45
45
macro_rules! assert {
46
46
( $cond: expr $( , ) ?) => {
47
- kani:: assert( $cond, concat!( "assertion failed: " , stringify!( $cond) ) ) ;
47
+ // The double negation is to resolve https://github.com/model-checking/kani/issues/2108
48
+ kani:: assert( !!$cond, concat!( "assertion failed: " , stringify!( $cond) ) ) ;
48
49
} ;
49
50
( $cond: expr, $( $arg: tt) +) => { {
50
- kani:: assert( $cond, concat!( stringify!( $( $arg) +) ) ) ;
51
+ kani:: assert( !! $cond, concat!( stringify!( $( $arg) +) ) ) ;
51
52
// Process the arguments of the assert inside an unreachable block. This
52
53
// is to make sure errors in the arguments (e.g. an unknown variable or
53
54
// an argument that does not implement the Display or Debug traits) are
Original file line number Diff line number Diff line change
1
+ // Copyright Kani Contributors
2
+ // SPDX-License-Identifier: Apache-2.0 OR MIT
3
+
4
+ //! This test makes sure Kani handles the valid `assert!(&b)` syntax where `b` is a `bool`
5
+ //! See https://github.com/model-checking/kani/issues/2108 for details.
6
+
7
+ #[ kani:: proof]
8
+ fn check_assert_with_reg ( ) {
9
+ let b1: bool = kani:: any ( ) ;
10
+ let b2 = b1 || !b1; // true
11
+ assert ! ( & b2) ;
12
+ }
You can’t perform that action at this time.
0 commit comments