about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAriel Ben-Yehuda <arielb1@mail.tau.ac.il>2017-03-08 20:54:08 +0200
committerGitHub <noreply@github.com>2017-03-08 20:54:08 +0200
commitaea8010098d6387f68440577b691e48e9ab5cc6a (patch)
treee75cb174cc3c5d051cf72c1f634cc4e0700a4bcd
parente8eb05cddd71f008300442a95140ee46fb9ed8ea (diff)
parent025bf9582eb97d72d71ed54fc52941dbb836cf48 (diff)
downloadrust-aea8010098d6387f68440577b691e48e9ab5cc6a.tar.gz
rust-aea8010098d6387f68440577b691e48e9ab5cc6a.zip
Rollup merge of #40333 - tbu-:pr_doc_ptr_write, r=alexcrichton
Clarify handling of `src` in `ptr::write`

Fixes #39733.
-rw-r--r--src/libcore/ptr.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs
index 02851c224e2..260fdab9d58 100644
--- a/src/libcore/ptr.rs
+++ b/src/libcore/ptr.rs
@@ -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.
 ///