mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-28 20:16:58 +03:00
rollup merge of #19483: cgaebel/copy_memory-comment
This commit is contained in:
@@ -1781,12 +1781,13 @@ fn set_memory(&mut self, value: u8) {
|
||||
|
||||
/// Copies data from `src` to `dst`
|
||||
///
|
||||
/// `src` and `dst` must not overlap. Panics if the length of `dst`
|
||||
/// is less than the length of `src`.
|
||||
/// Panics if the length of `dst` is less than the length of `src`.
|
||||
#[inline]
|
||||
pub fn copy_memory(dst: &mut [u8], src: &[u8]) {
|
||||
let len_src = src.len();
|
||||
assert!(dst.len() >= len_src);
|
||||
// `dst` is unaliasable, so we know statically it doesn't overlap
|
||||
// with `src`.
|
||||
unsafe {
|
||||
ptr::copy_nonoverlapping_memory(dst.as_mut_ptr(),
|
||||
src.as_ptr(),
|
||||
|
||||
Reference in New Issue
Block a user