about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMark Simulacrum <mark.simulacrum@gmail.com>2018-06-02 13:14:24 -0600
committerGitHub <noreply@github.com>2018-06-02 13:14:24 -0600
commitdd61a32459cfc18d0bd216c581c0872350f28cd3 (patch)
tree2fa8c4951afe122fa00c8fe77029ab07daa59b19 /src
parent6ff9108e120d728f7f5f2cf852280d411e47ce31 (diff)
parent61b5bd25b528853f1b3064bbba3328a3360e8101 (diff)
downloadrust-dd61a32459cfc18d0bd216c581c0872350f28cd3.tar.gz
rust-dd61a32459cfc18d0bd216c581c0872350f28cd3.zip
Rollup merge of #51124 - frewsxcv:frewsxcv-replace, r=QuietMisdreavus
Reword {ptr,mem}::replace docs.

Fixes https://github.com/rust-lang/rust/issues/50657.
Diffstat (limited to 'src')
-rw-r--r--src/libcore/mem.rs5
-rw-r--r--src/libcore/ptr.rs5
2 files changed, 6 insertions, 4 deletions
diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs
index c033b670798..9fed4990345 100644
--- a/src/libcore/mem.rs
+++ b/src/libcore/mem.rs
@@ -635,8 +635,9 @@ pub fn swap<T>(x: &mut T, y: &mut T) {
     }
 }
 
-/// Replaces the value at a mutable location with a new one, returning the old value, without
-/// deinitializing either one.
+/// Moves `src` into the referenced `dest`, returning the previous `dest` value.
+///
+/// Neither value is dropped.
 ///
 /// # Examples
 ///
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs
index 6c0709caa08..39315d8f0c8 100644
--- a/src/libcore/ptr.rs
+++ b/src/libcore/ptr.rs
@@ -239,8 +239,9 @@ unsafe fn swap_nonoverlapping_bytes(x: *mut u8, y: *mut u8, len: usize) {
     }
 }
 
-/// Replaces the value at `dest` with `src`, returning the old
-/// value, without dropping either.
+/// Moves `src` into the pointed `dest`, returning the previous `dest` value.
+///
+/// Neither value is dropped.
 ///
 /// # Safety
 ///