Skip to content

Commit a6358f5

Browse files
committed
rollup merge of #19483: cgaebel/copy_memory-comment
2 parents 1b2b24a + 851c7b5 commit a6358f5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/libcore/slice.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1781,12 +1781,13 @@ pub mod bytes {
17811781

17821782
/// Copies data from `src` to `dst`
17831783
///
1784-
/// `src` and `dst` must not overlap. Panics if the length of `dst`
1785-
/// is less than the length of `src`.
1784+
/// Panics if the length of `dst` is less than the length of `src`.
17861785
#[inline]
17871786
pub fn copy_memory(dst: &mut [u8], src: &[u8]) {
17881787
let len_src = src.len();
17891788
assert!(dst.len() >= len_src);
1789+
// `dst` is unaliasable, so we know statically it doesn't overlap
1790+
// with `src`.
17901791
unsafe {
17911792
ptr::copy_nonoverlapping_memory(dst.as_mut_ptr(),
17921793
src.as_ptr(),

0 commit comments

Comments
 (0)