File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 124124//! list element will patch the pointers of its predecessor and successor to remove itself
125125//! from the list.
126126//!
127- //! To make this work, it is crucial that we can actually rely on `drop` being called.
128- //! And, in fact, this is a guarantee that `Pin` provides.
127+ //! Crucially, we have to be able to rely on `drop` being called. If an element
128+ //! could be deallocated or otherwise invalidated without calling `drop`, the pointers into it
129+ //! from its neighbouring elements would become invalid, which would break the data structure.
130+ //!
131+ //! This is why pinning also comes with a `drop`-related guarantee.
129132//!
130133//! # `Drop` guarantee
131134//!
139142//! off of a vector.
140143//!
141144//! This is exactly the kind of guarantee that the intrusive linked list from the previous
142- //! section needs to function correctly. Clearly, if an element
143- //! could be deallocated or otherwise invalidated without calling `drop`, the pointers into it
144- //! from its neighbouring elements would become invalid, which would break the data structure.
145+ //! section needs to function correctly.
145146//!
146147//! Notice that this guarantee does *not* mean that memory does not leak! It is still
147148//! completely okay not to ever call `drop` on a pinned element (e.g., you can still
You can’t perform that action at this time.
0 commit comments