Skip to content

Commit 6dc5573

Browse files
author
bors-servo
authored
Auto merge of #76 - mbrubeck:copy, r=jdm
Use copy_nonoverlapping in insert_from_slice Since this method takes a unique reference to `self`, we know that it can't overlap with `slice`. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-smallvec/76) <!-- Reviewable:end -->
2 parents 7947024 + e6cfe76 commit 6dc5573

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ impl<A: Array> SmallVec<A> where A::Item: Copy {
730730
let slice_ptr = slice.as_ptr();
731731
let ptr = self.as_mut_ptr().offset(index as isize);
732732
ptr::copy(ptr, ptr.offset(slice.len() as isize), len - index);
733-
ptr::copy(slice_ptr, ptr, slice.len());
733+
ptr::copy_nonoverlapping(slice_ptr, ptr, slice.len());
734734
self.set_len(len + slice.len());
735735
}
736736
}

0 commit comments

Comments
 (0)