Skip to content

Commit 7469d61

Browse files
committed
Finish polishing contracts and create expected
1 parent e844934 commit 7469d61

File tree

6 files changed

+23
-5
lines changed

6 files changed

+23
-5
lines changed

tests/std-checks/core/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ description = "This crate contains contracts and harnesses for core library"
88

99
[package.metadata.kani]
1010
unstable = { function-contracts = true, mem-predicates = true }
11+
12+
[package.metadata.kani.flags]
13+
output-format = "terse"

tests/std-checks/core/expected

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/std-checks/core/mem.expected

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Summary:
2+
Verification failed for - mem::verify::check_swap_unit
3+
Complete - 3 successfully verified harnesses, 1 failures, 4 total.

tests/std-checks/core/ptr.expected

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Summary:
2+
Verification failed for - ptr::verify::check_replace_unit
3+
Complete - 5 successfully verified harnesses, 1 failures, 6 total.

tests/std-checks/core/src/mem.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ mod verify {
4242
contracts::swap(&mut x, &mut y)
4343
}
4444

45+
/// FIX-ME: Modifies clause fail with pointer to ZST.
46+
/// <https://github.com/model-checking/kani/issues/3181>
47+
/// FIX-ME: `typed_swap` intrisic fails for ZST.
48+
/// <https://github.com/model-checking/kani/issues/3182>
4549
#[kani::proof_for_contract(contracts::swap)]
4650
pub fn check_swap_unit() {
4751
let mut x: () = kani::any();

tests/std-checks/core/src/ptr.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,22 @@ mod verify {
7272

7373
#[kani::proof_for_contract(contracts::as_ref)]
7474
pub fn check_as_ref() {
75+
let ptr = kani::any::<Box<usize>>();
76+
let non_null = NonNull::new(Box::into_raw(ptr)).unwrap();
77+
let _rf = unsafe { contracts::as_ref(&non_null) };
78+
}
79+
80+
#[kani::proof_for_contract(contracts::as_ref)]
81+
#[kani::should_panic]
82+
pub fn check_as_ref_dangling() {
7583
let ptr = kani::any::<usize>() as *mut u8;
7684
kani::assume(!ptr.is_null());
77-
let Some(non_null) = NonNull::new(ptr) else {
78-
unreachable!();
79-
};
85+
let non_null = NonNull::new(ptr).unwrap();
8086
let _rf = unsafe { contracts::as_ref(&non_null) };
8187
}
8288

8389
/// FIX-ME: Modifies clause fail with pointer to ZST.
84-
#[cfg(fixme)]
90+
/// <https://github.com/model-checking/kani/issues/3181>
8591
#[kani::proof_for_contract(contracts::replace)]
8692
pub fn check_replace_unit() {
8793
check_replace_impl::<()>();

0 commit comments

Comments
 (0)