Skip to content
/ rust Public
forked from rust-lang/rust
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5b49da9

Browse files
authoredMar 16, 2025
Rollup merge of rust-lang#136359 - hkBst:ptr_copy_docs, r=Amanieu
doc all differences of ptr:copy(_nonoverlapping) with memcpy and memmove Fixes rust-lang#79430
2 parents 0e11536 + 8156e06 commit 5b49da9

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
@@ -3641,7 +3641,8 @@ pub const fn ptr_metadata<P: ptr::Pointee<Metadata = M> + ?Sized, M>(ptr: *const
36413641
/// For regions of memory which might overlap, use [`copy`] instead.
36423642
///
36433643
/// `copy_nonoverlapping` is semantically equivalent to C's [`memcpy`], but
3644-
/// with the argument order swapped.
3644+
/// with the source and destination arguments swapped,
3645+
/// and `count` counting the number of `T`s instead of bytes.
36453646
///
36463647
/// The copy is "untyped" in the sense that data may be uninitialized or otherwise violate the
36473648
/// requirements of `T`. The initialization state is preserved exactly.
@@ -3761,8 +3762,10 @@ pub const unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: us
37613762
/// If the source and destination will *never* overlap,
37623763
/// [`copy_nonoverlapping`] can be used instead.
37633764
///
3764-
/// `copy` is semantically equivalent to C's [`memmove`], but with the argument
3765-
/// order swapped. Copying takes place as if the bytes were copied from `src`
3765+
/// `copy` is semantically equivalent to C's [`memmove`], but
3766+
/// with the source and destination arguments swapped,
3767+
/// and `count` counting the number of `T`s instead of bytes.
3768+
/// Copying takes place as if the bytes were copied from `src`
37663769
/// to a temporary array and then copied from the array to `dst`.
37673770
///
37683771
/// 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.