@@ -554,30 +554,30 @@ impl<A: Array> StackVec<A> {
554
554
unsafe {
555
555
let old_len = self . len ( ) ;
556
556
assert ! ( index <= old_len) ;
557
- let mut ptr = self . as_mut_ptr ( ) . add ( index) ;
557
+ let mut ptr = self . as_mut_ptr ( ) . padd ( index) ;
558
558
559
559
// Move the trailing elements.
560
- ptr:: copy ( ptr, ptr. add ( lower_size_bound) , old_len - index) ;
560
+ ptr:: copy ( ptr, ptr. padd ( lower_size_bound) , old_len - index) ;
561
561
562
562
// In case the iterator panics, don't double-drop the items we just copied above.
563
563
self . set_len ( index) ;
564
564
565
565
let mut num_added = 0 ;
566
566
for element in iter {
567
- let mut cur = ptr. add ( num_added) ;
567
+ let mut cur = ptr. padd ( num_added) ;
568
568
if num_added >= lower_size_bound {
569
569
// Iterator provided more elements than the hint. Move trailing items again.
570
570
assert ! ( self . len( ) + 1 <= self . capacity( ) ) ;
571
- ptr = self . as_mut_ptr ( ) . add ( index) ;
572
- cur = ptr. add ( num_added) ;
573
- ptr:: copy ( cur, cur. add ( 1 ) , old_len - index) ;
571
+ ptr = self . as_mut_ptr ( ) . padd ( index) ;
572
+ cur = ptr. padd ( num_added) ;
573
+ ptr:: copy ( cur, cur. padd ( 1 ) , old_len - index) ;
574
574
}
575
575
ptr:: write ( cur, element) ;
576
576
num_added += 1 ;
577
577
}
578
578
if num_added < lower_size_bound {
579
579
// Iterator provided fewer elements than the hint
580
- ptr:: copy ( ptr. add ( lower_size_bound) , ptr. add ( num_added) , old_len - index) ;
580
+ ptr:: copy ( ptr. padd ( lower_size_bound) , ptr. padd ( num_added) , old_len - index) ;
581
581
}
582
582
583
583
self . set_len ( old_len + num_added) ;
0 commit comments