Skip to content

Commit 058fb50

Browse files
fu5haManishearth
authored andcommittedJan 7, 2024
trim section on managed-box model
1 parent 9997114 commit 058fb50

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed
 

Diff for: ‎library/core/src/pin.rs

+4-9
Original file line numberDiff line numberDiff line change
@@ -183,22 +183,17 @@
183183
//! access to that data to ensure no *moves* or other invalidation occurs, and finally
184184
//! provide a safe interface on top.
185185
//!
186-
//! There are a couple of linked disadvantages to using this model. The core issue is a lack
187-
//! of generality. This is an issue because it means that each individual type that implements
188-
//! such an interface does so on its own. Each developer implementing such a type must themselves
189-
//! think through all the guarantees needed to ensure the API they present is sound. We would
190-
//! rather build a shared understanding of the problem space and encode that understanding into a
191-
//! shared interface to solve it which everyone helps validate.
192-
//!
193-
//! In addition, in this model, each individual object must assume it is *on its own* to ensure
186+
//! There are a couple of linked disadvantages to using this model. The most significant is that
187+
//! each individual object must assume it is *on its own* to ensure
194188
//! that its data does not become *moved* or otherwise invalidated. Since there is no shared
195189
//! contract between values of different types, an object cannot assume that others interacting
196190
//! with it will properly respect the invariants around interacting with its data and must
197191
//! therefore protect it from everyone. Because of this, *composition* of address-sensitive types
198192
//! requires at least a level of pointer indirection each time a new object is added to the mix
199193
//! (and, practically, a heap allocation).
200194
//!
201-
//! This is the key thing that drove Rust towards a different model. It is particularly a problem
195+
//! Although there were other reason as well, this issue of expensive composition is the key thing
196+
//! that drove Rust towards adopting a different model. It is particularly a problem
202197
//! when one considers, for exapmle, the implications of composing together the [`Future`]s which
203198
//! will eventaully make up an asynchronous task (including address-sensitive `async fn` state
204199
//! machines). It is plausible that there could be many layers of [`Future`]s composed together,

0 commit comments

Comments
 (0)