diff options
| author | Marijn Schouten <mhkbst@gmail.com> | 2025-01-31 17:29:45 +0100 |
|---|---|---|
| committer | Marijn Schouten <mhkbst@gmail.com> | 2025-01-31 17:29:45 +0100 |
| commit | 8156e062ee12f091e128db23f09d196cd028edc1 (patch) | |
| tree | d585c446bff3ca0cbd954a76dd749307bde4bfb3 /library/core/src | |
| parent | 7f36543a48e52912ac6664a70c0a5b9d86509eaf (diff) | |
| download | rust-8156e062ee12f091e128db23f09d196cd028edc1.tar.gz rust-8156e062ee12f091e128db23f09d196cd028edc1.zip | |
doc all differences of ptr:copy(_nonoverlapping) with memcpy and memmove
Diffstat (limited to 'library/core/src')
| -rw-r--r-- | library/core/src/intrinsics/mod.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/library/core/src/intrinsics/mod.rs b/library/core/src/intrinsics/mod.rs index c0d435f99c0..5683377774c 100644 --- a/library/core/src/intrinsics/mod.rs +++ b/library/core/src/intrinsics/mod.rs @@ -4250,7 +4250,8 @@ pub const fn ptr_metadata<P: ptr::Pointee<Metadata = M> + ?Sized, M>(_ptr: *cons /// For regions of memory which might overlap, use [`copy`] instead. /// /// `copy_nonoverlapping` is semantically equivalent to C's [`memcpy`], but -/// with the argument order swapped. +/// with the source and destination arguments swapped, +/// and `count` counting the number of `T`s instead of bytes. /// /// The copy is "untyped" in the sense that data may be uninitialized or otherwise violate the /// requirements of `T`. The initialization state is preserved exactly. @@ -4377,8 +4378,10 @@ pub const unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: us /// If the source and destination will *never* overlap, /// [`copy_nonoverlapping`] can be used instead. /// -/// `copy` is semantically equivalent to C's [`memmove`], but with the argument -/// order swapped. Copying takes place as if the bytes were copied from `src` +/// `copy` is semantically equivalent to C's [`memmove`], but +/// with the source and destination arguments swapped, +/// and `count` counting the number of `T`s instead of bytes. +/// Copying takes place as if the bytes were copied from `src` /// to a temporary array and then copied from the array to `dst`. /// /// The copy is "untyped" in the sense that data may be uninitialized or otherwise violate the |
