Skip to content

Commit ee9b7c3

Browse files
authored
Enable harnesses that were blocked by Kani's spurious CEX (#211)
In #148 and #122, we had to comment out a few harnesses due to the issue model-checking/kani#3670. But now that the fix has been pushed, we can enable them.
1 parent eae6c8b commit ee9b7c3

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

library/core/src/slice/iter.rs

+14-8
Original file line numberDiff line numberDiff line change
@@ -3604,18 +3604,24 @@ mod verify {
36043604
}
36053605

36063606
check_unsafe_contracts!(check_next_back_unchecked, $ty, next_back_unchecked());
3607-
//check_unsafe_contracts!(check_post_inc_start, $ty, post_inc_start(kani::any()));
3608-
//check_unsafe_contracts!(check_pre_dec_end, $ty, pre_dec_end(kani::any()));
3607+
check_unsafe_contracts!(check_post_inc_start, $ty, post_inc_start(kani::any()));
3608+
check_unsafe_contracts!(check_pre_dec_end, $ty, pre_dec_end(kani::any()));
36093609

36103610
// FIXME: The functions that are commented out are currently failing verification.
36113611
// Debugging the issue is currently blocked by:
36123612
// https://github.com/model-checking/kani/issues/3670
36133613
//
36143614
// Public functions that call safe abstraction `make_slice`.
3615-
// check_safe_abstraction!(check_as_slice, $ty, as_slice);
3616-
// check_safe_abstraction!(check_as_ref, $ty, as_ref);
3615+
check_safe_abstraction!(check_as_slice, $ty, |iter: &mut Iter<'_, $ty>| {
3616+
iter.as_slice();
3617+
});
3618+
check_safe_abstraction!(check_as_ref, $ty, |iter: &mut Iter<'_, $ty>| {
3619+
iter.as_ref();
3620+
});
36173621

3618-
// check_safe_abstraction!(check_advance_back_by, $ty, advance_back_by, kani::any());
3622+
check_safe_abstraction!(check_advance_back_by, $ty, |iter: &mut Iter<'_, $ty>| {
3623+
iter.advance_back_by(kani::any());
3624+
});
36193625

36203626
check_safe_abstraction!(check_is_empty, $ty, |iter: &mut Iter<'_, $ty>| {
36213627
let _ = iter.is_empty();
@@ -3626,12 +3632,12 @@ mod verify {
36263632
check_safe_abstraction!(check_size_hint, $ty, |iter: &mut Iter<'_, $ty>| {
36273633
let _ = iter.size_hint();
36283634
});
3629-
//check_safe_abstraction!(check_nth, $ty, |iter: &mut Iter<'_, $ty>| { let _ = iter.nth(kani::any()); });
3630-
//check_safe_abstraction!(check_advance_by, $ty, |iter: &mut Iter<'_, $ty>| { let _ = iter.advance_by(kani::any()); });
3635+
check_safe_abstraction!(check_nth, $ty, |iter: &mut Iter<'_, $ty>| { let _ = iter.nth(kani::any()); });
3636+
check_safe_abstraction!(check_advance_by, $ty, |iter: &mut Iter<'_, $ty>| { let _ = iter.advance_by(kani::any()); });
36313637
check_safe_abstraction!(check_next_back, $ty, |iter: &mut Iter<'_, $ty>| {
36323638
let _ = iter.next_back();
36333639
});
3634-
//check_safe_abstraction!(check_nth_back, $ty, |iter: &mut Iter<'_, $ty>| { let _ = iter.nth_back(kani::any()); });
3640+
check_safe_abstraction!(check_nth_back, $ty, |iter: &mut Iter<'_, $ty>| { let _ = iter.nth_back(kani::any()); });
36353641
check_safe_abstraction!(check_next, $ty, |iter: &mut Iter<'_, $ty>| {
36363642
let _ = iter.next();
36373643
});

library/core/src/str/pattern.rs

-5
Original file line numberDiff line numberDiff line change
@@ -2000,10 +2000,6 @@ pub mod verify {
20002000
}
20012001
}
20022002

2003-
/* This harness check `small_slice_eq` with dangling pointer to slice
2004-
with zero size. Kani finds safety issue of `small_slice_eq` in this
2005-
harness and hence the proof will fail.
2006-
20072003
#[cfg(all(kani, target_arch = "x86_64"))] // only called on x86
20082004
#[kani::proof]
20092005
#[kani::unwind(4)]
@@ -2022,5 +2018,4 @@ pub mod verify {
20222018
true
20232019
);
20242020
}
2025-
*/
20262021
}

0 commit comments

Comments
 (0)