diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-02-24 20:10:13 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-24 20:10:13 +0100 |
| commit | 3e7a18e5e5efb870b9c4c7c4bd7a310270187213 (patch) | |
| tree | 3f5326b21e469c2c24a6471752b92d2b834ac79b /src/libcore | |
| parent | d91657877a44ecc9450b6d996bef577a1d1ec647 (diff) | |
| parent | ad47bf50f6ff9d7a73e54bed6ab518c01ae2fdc5 (diff) | |
Rollup merge of #69391 - memoryruins:memalias, r=Mark-Simulacrum
Add rustdoc aliases to `ptr::copy` and `ptr::copy_nonoverlapping` This PR adds a [rustdoc alias](https://doc.rust-lang.org/nightly/rustdoc/unstable-features.html#add-aliases-for-an-item-in-documentation-search) to `ptr::copy` and `ptr::copy_nonoverlapping` using the commonly used terms `memcpy` and `memmove`. The motivation for this PR is to improve discoverability for these functions, since I've noticed users overlook these functions on multiple occasions (and they have thus reached for [libc](https://crates.io/crates/libc) without need). Currently std docs state: https://doc.rust-lang.org/nightly/std/ptr/fn.copy_nonoverlapping.html > `copy_nonoverlapping` is semantically equivalent to C's `memcpy`, but with the argument order swapped. https://doc.rust-lang.org/nightly/std/ptr/fn.copy.html > `copy` is semantically equivalent to C's `memmove`, but with the argument order swapped. #### search results before adding a rustdoc alias:   #### after adding `#[doc(alias = "memcpy")]` and `#[doc(alias = "memmove")]`:  
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/intrinsics.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 2cee23a5c75..43f8cfc0c47 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -1515,6 +1515,7 @@ fn overlaps<T>(src: *const T, dst: *const T, count: usize) -> bool { /// ``` /// /// [`Vec::append`]: ../../std/vec/struct.Vec.html#method.append +#[doc(alias = "memcpy")] #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize) { @@ -1579,6 +1580,7 @@ pub unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize) { /// dst /// } /// ``` +#[doc(alias = "memmove")] #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) { |
