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 124
124
//! list element will patch the pointers of its predecessor and successor to remove itself
125
125
//! from the list.
126
126
//!
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.
129
132
//!
130
133
//! # `Drop` guarantee
131
134
//!
139
142
//! off of a vector.
140
143
//!
141
144
//! 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.
145
146
//!
146
147
//! Notice that this guarantee does *not* mean that memory does not leak! It is still
147
148
//! 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