about summary refs log tree commit diff
path: root/src/libcore/ptr
diff options
context:
space:
mode:
authorDiggory Blake <diggsey@googlemail.com>2020-04-27 22:50:55 +0100
committerDiggory Blake <diggsey@googlemail.com>2020-05-15 19:53:05 +0100
commit7433c4ddf3c226fc6beeed7a79f7d48777a3e807 (patch)
treee95daa7ab89ebaa40bb69bbc4b881a17c8e4d24b /src/libcore/ptr
parent46ec74e60f238f694b46c976d6217e7cf8d4cf1a (diff)
downloadrust-7433c4ddf3c226fc6beeed7a79f7d48777a3e807.tar.gz
rust-7433c4ddf3c226fc6beeed7a79f7d48777a3e807.zip
Improve the documentation for ManuallyDrop to resolve conflicting usage of terminology.
Diffstat (limited to 'src/libcore/ptr')
-rw-r--r--src/libcore/ptr/mod.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libcore/ptr/mod.rs b/src/libcore/ptr/mod.rs
index 84f28488c74..115194a65a0 100644
--- a/src/libcore/ptr/mod.rs
+++ b/src/libcore/ptr/mod.rs
@@ -112,11 +112,17 @@ mod mut_ptr;
 ///   as the compiler doesn't need to prove that it's sound to elide the
 ///   copy.
 ///
+/// * It can be used to drop [pinned] data when `T` is not `repr(packed)`
+///   (pinned data must not be moved before it is dropped).
+///
 /// Unaligned values cannot be dropped in place, they must be copied to an aligned
-/// location first using [`ptr::read_unaligned`].
+/// location first using [`ptr::read_unaligned`]. For packed structs, this move is
+/// done automatically by the compiler. This means the fields of packed structs
+/// are not dropped in-place.
 ///
 /// [`ptr::read`]: ../ptr/fn.read.html
 /// [`ptr::read_unaligned`]: ../ptr/fn.read_unaligned.html
+/// [pinned]: ../pin/index.html
 ///
 /// # Safety
 ///