@@ -627,11 +627,12 @@ impl<T: PointeeSized> NonNull<T> {
627
627
#[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
628
628
#[ stable( feature = "non_null_convenience" , since = "1.80.0" ) ]
629
629
#[ 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))]
635
636
pub const unsafe fn byte_offset ( self , count : isize ) -> Self {
636
637
// SAFETY: the caller must uphold the safety contract for `offset` and `byte_offset` has
637
638
// the same safety contract.
@@ -2875,19 +2876,20 @@ mod verify {
2875
2876
// }
2876
2877
// }
2877
2878
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
+ // }
2891
2893
2892
2894
#[ kani:: proof_for_contract( NonNull :: byte_offset_from) ]
2893
2895
pub fn non_null_byte_offset_from_proof ( ) {
0 commit comments