File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -1060,7 +1060,8 @@ impl<T: ?Sized> *const T {
1060
1060
// Else if count is not zero, then ensure that adding `count` doesn't cause
1061
1061
// overflow and that both pointers `self` and the result are in the same
1062
1062
// allocation
1063
- ( ( self . addr( ) as isize ) . checked_add( count as isize ) . is_some( ) &&
1063
+ ( count <= isize :: MAX as usize &&
1064
+ ( self . addr( ) as isize ) . checked_add( count as isize ) . is_some( ) &&
1064
1065
core:: ub_checks:: same_allocation( self , self . wrapping_byte_add( count) ) )
1065
1066
) ]
1066
1067
#[ ensures( |& result|
@@ -1203,7 +1204,7 @@ impl<T: ?Sized> *const T {
1203
1204
// Else if count is not zero, then ensure that subtracting `count` doesn't
1204
1205
// cause overflow and that both pointers `self` and the result are in the
1205
1206
// same allocation
1206
- ( ( self . addr( ) as isize ) . checked_sub( count as isize ) . is_some( ) &&
1207
+ ( count <= isize :: MAX as usize && ( self . addr( ) as isize ) . checked_sub( count as isize ) . is_some( ) &&
1207
1208
core:: ub_checks:: same_allocation( self , self . wrapping_byte_sub( count) ) )
1208
1209
) ]
1209
1210
#[ ensures( |& result|
You can’t perform that action at this time.
0 commit comments