File tree 1 file changed +2
-16
lines changed
1 file changed +2
-16
lines changed Original file line number Diff line number Diff line change @@ -502,22 +502,8 @@ impl<T: ?Sized> NonNull<T> {
502
502
#[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
503
503
#[ stable( feature = "non_null_convenience" , since = "1.80.0" ) ]
504
504
#[ rustc_const_stable( feature = "non_null_convenience" , since = "1.80.0" ) ]
505
- #[ kani:: requires(
506
- if ( count >= 0 ) {
507
- kani:: mem:: same_allocation( self . as_ptr( ) as * const ( ) , self . as_ptr( ) . byte_add( count as usize ) as * const ( ) )
508
- } else {
509
- kani:: mem:: same_allocation( self . as_ptr( ) as * const ( ) , self . as_ptr( ) . byte_sub( -count as usize ) as * const ( ) )
510
- }
511
- ) ]
512
- #[ kani:: ensures( |result: & Self | {
513
- if ( count >= 0 ) {
514
- let offset_ptr = self . as_ptr( ) . byte_add( count as usize ) as * mut T ;
515
- result. as_ptr( ) == offset_ptr
516
- } else {
517
- let offset_ptr = self . as_ptr( ) . byte_sub( -count as usize ) as * mut T ;
518
- result. as_ptr( ) == offset_ptr
519
- }
520
- } ) ]
505
+ #[ kani:: requires( kani:: mem:: same_allocation( self . as_ptr( ) as * const ( ) , self . as_ptr( ) . byte_offset( count) as * const ( ) ) ) ]
506
+ #[ kani:: ensures( |result: & Self | result. as_ptr( ) == self . as_ptr( ) . byte_offset( count) ) ]
521
507
pub const unsafe fn byte_offset ( self , count : isize ) -> Self {
522
508
// SAFETY: the caller must uphold the safety contract for `offset` and `byte_offset` has
523
509
// the same safety contract.
You can’t perform that action at this time.
0 commit comments