Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8156e06

Browse files
committedJan 31, 2025
doc all differences of ptr:copy(_nonoverlapping) with memcpy and memmove
1 parent 7f36543 commit 8156e06

File tree

1 file changed

+6
-3
lines changed
  • library/core/src/intrinsics

1 file changed

+6
-3
lines changed
 

‎library/core/src/intrinsics/mod.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -4250,7 +4250,8 @@ pub const fn ptr_metadata<P: ptr::Pointee<Metadata = M> + ?Sized, M>(_ptr: *cons
42504250
/// For regions of memory which might overlap, use [`copy`] instead.
42514251
///
42524252
/// `copy_nonoverlapping` is semantically equivalent to C's [`memcpy`], but
4253-
/// with the argument order swapped.
4253+
/// with the source and destination arguments swapped,
4254+
/// and `count` counting the number of `T`s instead of bytes.
42544255
///
42554256
/// The copy is "untyped" in the sense that data may be uninitialized or otherwise violate the
42564257
/// 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
43774378
/// If the source and destination will *never* overlap,
43784379
/// [`copy_nonoverlapping`] can be used instead.
43794380
///
4380-
/// `copy` is semantically equivalent to C's [`memmove`], but with the argument
4381-
/// order swapped. Copying takes place as if the bytes were copied from `src`
4381+
/// `copy` is semantically equivalent to C's [`memmove`], but
4382+
/// with the source and destination arguments swapped,
4383+
/// and `count` counting the number of `T`s instead of bytes.
4384+
/// Copying takes place as if the bytes were copied from `src`
43824385
/// to a temporary array and then copied from the array to `dst`.
43834386
///
43844387
/// The copy is "untyped" in the sense that data may be uninitialized or otherwise violate the

0 commit comments

Comments
 (0)
Failed to load comments.