Skip to content

Commit 94afd99

Browse files
committed
Disable contract that requires Kani fix
1 parent df478ec commit 94afd99

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

library/core/src/ptr/non_null.rs

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -627,11 +627,12 @@ impl<T: PointeeSized> NonNull<T> {
627627
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
628628
#[stable(feature = "non_null_convenience", since = "1.80.0")]
629629
#[rustc_const_stable(feature = "non_null_convenience", since = "1.80.0")]
630-
#[requires(
631-
(self.as_ptr().addr() as isize).checked_add(count).is_some() &&
632-
core::ub_checks::same_allocation(self.as_ptr(), self.as_ptr().wrapping_byte_offset(count))
633-
)]
634-
#[ensures(|result: &Self| result.as_ptr() == self.as_ptr().wrapping_byte_offset(count))]
630+
// TODO: requires https://github.com/model-checking/kani/pull/4193
631+
// #[requires(
632+
// (self.as_ptr().addr() as isize).checked_add(count).is_some() &&
633+
// core::ub_checks::same_allocation(self.as_ptr(), self.as_ptr().wrapping_byte_offset(count))
634+
// )]
635+
// #[ensures(|result: &Self| result.as_ptr() == self.as_ptr().wrapping_byte_offset(count))]
635636
pub const unsafe fn byte_offset(self, count: isize) -> Self {
636637
// SAFETY: the caller must uphold the safety contract for `offset` and `byte_offset` has
637638
// the same safety contract.
@@ -2875,19 +2876,20 @@ mod verify {
28752876
// }
28762877
// }
28772878

2878-
#[kani::proof_for_contract(NonNull::byte_offset)]
2879-
pub fn non_null_byte_offset_proof() {
2880-
const ARR_SIZE: usize = mem::size_of::<i32>() * 1000;
2881-
let mut generator = PointerGenerator::<ARR_SIZE>::new();
2882-
2883-
let count: isize = kani::any();
2884-
let raw_ptr: *mut i32 = generator.any_in_bounds().ptr as *mut i32;
2885-
2886-
unsafe {
2887-
let ptr = NonNull::new(raw_ptr).unwrap();
2888-
let result = ptr.byte_offset(count);
2889-
}
2890-
}
2879+
// TODO: requires https://github.com/model-checking/kani/pull/4193
2880+
// #[kani::proof_for_contract(NonNull::byte_offset)]
2881+
// pub fn non_null_byte_offset_proof() {
2882+
// const ARR_SIZE: usize = mem::size_of::<i32>() * 1000;
2883+
// let mut generator = PointerGenerator::<ARR_SIZE>::new();
2884+
//
2885+
// let count: isize = kani::any();
2886+
// let raw_ptr: *mut i32 = generator.any_in_bounds().ptr as *mut i32;
2887+
//
2888+
// unsafe {
2889+
// let ptr = NonNull::new(raw_ptr).unwrap();
2890+
// let result = ptr.byte_offset(count);
2891+
// }
2892+
// }
28912893

28922894
#[kani::proof_for_contract(NonNull::byte_offset_from)]
28932895
pub fn non_null_byte_offset_from_proof() {

0 commit comments

Comments
 (0)