Skip to content

Commit 61b5bd2

Browse files
committed
Reword {ptr,mem}::replace docs.
Fixes #50657.
1 parent 68e0e58 commit 61b5bd2

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/libcore/mem.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -635,8 +635,9 @@ pub fn swap<T>(x: &mut T, y: &mut T) {
635635
}
636636
}
637637

638-
/// Replaces the value at a mutable location with a new one, returning the old value, without
639-
/// deinitializing either one.
638+
/// Moves `src` into the referenced `dest`, returning the previous `dest` value.
639+
///
640+
/// Neither value is dropped.
640641
///
641642
/// # Examples
642643
///

src/libcore/ptr.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,9 @@ unsafe fn swap_nonoverlapping_bytes(x: *mut u8, y: *mut u8, len: usize) {
239239
}
240240
}
241241

242-
/// Replaces the value at `dest` with `src`, returning the old
243-
/// value, without dropping either.
242+
/// Moves `src` into the pointed `dest`, returning the previous `dest` value.
243+
///
244+
/// Neither value is dropped.
244245
///
245246
/// # Safety
246247
///

0 commit comments

Comments
 (0)