@@ -507,7 +507,7 @@ impl<T, const CAP: usize> ArrayVec<T, CAP> {
507
507
}
508
508
if DELETED {
509
509
unsafe {
510
- let hole_slot = g . v . as_mut_ptr ( ) . add ( g . processed_len - g. deleted_cnt ) ;
510
+ let hole_slot = cur . sub ( g. deleted_cnt ) ;
511
511
ptr:: copy_nonoverlapping ( cur, hole_slot, 1 ) ;
512
512
}
513
513
}
@@ -978,9 +978,8 @@ impl<'a, T: 'a, const CAP: usize> Drop for Drain<'a, T, CAP> {
978
978
// memmove back untouched tail, update to new length
979
979
let start = source_vec. len ( ) ;
980
980
let tail = self . tail_start ;
981
- let src = source_vec. as_ptr ( ) . add ( tail) ;
982
- let dst = source_vec. as_mut_ptr ( ) . add ( start) ;
983
- ptr:: copy ( src, dst, self . tail_len ) ;
981
+ let ptr = source_vec. as_mut_ptr ( ) ;
982
+ ptr:: copy ( ptr. add ( tail) , ptr. add ( start) , self . tail_len ) ;
984
983
source_vec. set_len ( start + self . tail_len ) ;
985
984
}
986
985
}
@@ -1082,7 +1081,7 @@ impl<T, const CAP: usize> ArrayVec<T, CAP> {
1082
1081
unsafe fn raw_ptr_add < T > ( ptr : * mut T , offset : usize ) -> * mut T {
1083
1082
if mem:: size_of :: < T > ( ) == 0 {
1084
1083
// Special case for ZST
1085
- ( ptr as usize ) . wrapping_add ( offset) as _
1084
+ ptr. cast :: < u8 > ( ) . wrapping_add ( offset) . cast ( )
1086
1085
} else {
1087
1086
ptr. add ( offset)
1088
1087
}
0 commit comments