We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 1b2b24a + 851c7b5 commit a6358f5Copy full SHA for a6358f5
src/libcore/slice.rs
@@ -1781,12 +1781,13 @@ pub mod bytes {
1781
1782
/// Copies data from `src` to `dst`
1783
///
1784
- /// `src` and `dst` must not overlap. Panics if the length of `dst`
1785
- /// is less than the length of `src`.
+ /// Panics if the length of `dst` is less than the length of `src`.
1786
#[inline]
1787
pub fn copy_memory(dst: &mut [u8], src: &[u8]) {
1788
let len_src = src.len();
1789
assert!(dst.len() >= len_src);
+ // `dst` is unaliasable, so we know statically it doesn't overlap
1790
+ // with `src`.
1791
unsafe {
1792
ptr::copy_nonoverlapping_memory(dst.as_mut_ptr(),
1793
src.as_ptr(),
0 commit comments