about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2020-04-27 14:45:37 +0200
committerRalf Jung <post@ralfj.de>2020-04-27 14:45:37 +0200
commit33541d5e55c3114e01e06b27715ae04372ce027f (patch)
treeb68956e99cb39c11e959333edb6495dbe14d4641 /src/libcore
parentef71df106b957eb84c1f028240ba8e85b614d043 (diff)
clarify interaction of pin drop guarantee and panics
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/pin.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libcore/pin.rs b/src/libcore/pin.rs
index 774ecd997c2..6f5bf7ad9da 100644
--- a/src/libcore/pin.rs
+++ b/src/libcore/pin.rs
@@ -139,10 +139,12 @@
 //! otherwise invalidating the memory used to store the data is restricted, too.
 //! Concretely, for pinned data you have to maintain the invariant
 //! that *its memory will not get invalidated or repurposed from the moment it gets pinned until
-//! when [`drop`] is called*. Memory can be invalidated by deallocation, but also by
+//! when [`drop`] is called*.  Only once [`drop`] returns or panics, the memory may be reused.
+//!
+//! Memory can be "invalidated" by deallocation, but also by
 //! replacing a [`Some(v)`] by [`None`], or calling [`Vec::set_len`] to "kill" some elements
 //! off of a vector. It can be repurposed by using [`ptr::write`] to overwrite it without
-//! calling the destructor first.
+//! calling the destructor first. None of this is allowed for pinned data without calling [`drop`].
 //!
 //! This is exactly the kind of guarantee that the intrusive linked list from the previous
 //! section needs to function correctly.