Skip to content

Commit d640ef6

Browse files
committed
Disable check_grow_impl as we cannot currently express the necessary precondition
1 parent d28ca19 commit d640ef6

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

library/alloc/src/alloc.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -459,15 +459,17 @@ mod verify {
459459
let _ = Global.alloc_impl(kani::any(), kani::any());
460460
}
461461

462-
// unsafe fn grow_impl(&self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, zeroed: bool) -> Result<NonNull<[u8]>, AllocError>
463-
#[kani::proof_for_contract(Global::grow_impl)]
464-
pub fn check_grow_impl() {
465-
let raw_ptr = kani::any::<usize>() as *mut u8;
466-
unsafe {
467-
let n = NonNull::new_unchecked(raw_ptr);
468-
let _ = Global.grow_impl(n, kani::any(), kani::any(), kani::any());
469-
}
470-
}
462+
// TODO: Kani correctly detects that the precondition is too weak. We'd need a way to express
463+
// that ptr either points to a ZST (we can do this), or else is heap-allocated (we cannot).
464+
// // unsafe fn grow_impl(&self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, zeroed: bool) -> Result<NonNull<[u8]>, AllocError>
465+
// #[kani::proof_for_contract(Global::grow_impl)]
466+
// pub fn check_grow_impl() {
467+
// let raw_ptr = kani::any::<usize>() as *mut u8;
468+
// unsafe {
469+
// let n = NonNull::new_unchecked(raw_ptr);
470+
// let _ = Global.grow_impl(n, kani::any(), kani::any(), kani::any());
471+
// }
472+
// }
471473

472474
// TODO: disabled as Kani does not currently support contracts on traits. See
473475
// https://github.com/model-checking/kani/issues/1997

0 commit comments

Comments
 (0)