From 61b5bd25b528853f1b3064bbba3328a3360e8101 Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Mon, 28 May 2018 08:36:14 -0400 Subject: [PATCH] Reword {ptr,mem}::replace docs. Fixes https://github.com/rust-lang/rust/issues/50657. --- src/libcore/mem.rs | 5 +++-- src/libcore/ptr.rs | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 059c099d66b56..e4e3b1c2a3a39 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -635,8 +635,9 @@ pub fn swap(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 6c0709caa084b..39315d8f0c8f8 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 ///