]> git.lizzy.rs Git - rust.git/commitdiff
Clarify handling of `src` in `ptr::write`
authorTobias Bucher <tobiasbucher5991@gmail.com>
Tue, 7 Mar 2017 22:39:49 +0000 (23:39 +0100)
committerTobias Bucher <tobiasbucher5991@gmail.com>
Tue, 7 Mar 2017 22:39:49 +0000 (23:39 +0100)
Fixes #39733.

src/libcore/ptr.rs

index 02851c224e2e35b019c8cd6a0a06446156916716..260fdab9d58fb5205faa1d1f6aa226c7f5c629cf 100644 (file)
@@ -191,6 +191,10 @@ pub unsafe fn read_unaligned<T>(src: *const T) -> T {
 /// allocations or resources, so care must be taken not to overwrite an object
 /// that should be dropped.
 ///
+/// It does not immediately drop the contents of `src` either; it is rather
+/// *moved* into the memory location `dst` and will be dropped whenever that
+/// location goes out of scope.
+///
 /// This is appropriate for initializing uninitialized memory, or overwriting
 /// memory that has previously been `read` from.
 ///