|
9 | 9 | //! 2. More generally, remain *valid* at that same memory location |
10 | 10 | //! |
11 | 11 | //! is called "pinning." We would say that a value which satisfies these guarantees has been |
12 | | -//! "pinned," in that it has been permanently (until the end of its lifetime) attached to its |
| 12 | +//! "pinned," in that it has been permanently (until the end of its lifespan) attached to its |
13 | 13 | //! location in memory, as though pinned to a pinboard. Pinning a value is incredibly useful in |
14 | 14 | //! that it provides the necessary guarantees[^guarantees] for [`unsafe`] code to be able to |
15 | 15 | //! dereference raw pointers to the pinned value for the duration it is pinned (which, |
16 | 16 | //! [as we'll see later][drop-guarantee], is necessarily from the time the value is first pinned |
17 | | -//! until the end of its lifetime). This concept of "pinning" is necessary to implement safe |
| 17 | +//! until the end of its lifespan). This concept of "pinning" is necessary to implement safe |
18 | 18 | //! interfaces on top of things like self-referential types and intrusive data structures which |
19 | 19 | //! cannot currently be modeled in fully safe Rust using only borrow-checked |
20 | 20 | //! [references][reference]. |
|
126 | 126 | //! [`Pin`] is specifically targeted at allowing the implementation of *safe interfaces* around |
127 | 127 | //! types which have some state during which they become "address-sensitive." A value in such an |
128 | 128 | //! "address-sensitive" state is *not* okay with being *moved* around at-will. Such a value must |
129 | | -//! stay *un-moved* and valid during the address-sensitive portion of its lifetime because some |
| 129 | +//! stay *un-moved* and valid during the address-sensitive portion of its lifespan because some |
130 | 130 | //! interface is relying on those invariants to be true in order for its implementation to be sound. |
131 | 131 | //! |
132 | 132 | //! As a motivating example of a type which may become address-sensitive, consider a type which |
|
535 | 535 | //! but it also implies that, |
536 | 536 | //! |
537 | 537 | //! 2. The memory location that stores the value must not get invalidated or otherwise repurposed |
538 | | -//! during the lifetime of the pinned value until its [`drop`] returns or panics |
| 538 | +//! during the lifespan of the pinned value until its [`drop`] returns or panics |
539 | 539 | //! |
540 | 540 | //! This point is subtle but required for intrusive data structures to be implemented soundly. |
541 | 541 | //! |
@@ -1505,8 +1505,8 @@ impl<'a, T: ?Sized> Pin<&'a T> { |
1505 | 1505 | /// Note: `Pin` also implements `Deref` to the target, which can be used |
1506 | 1506 | /// to access the inner value. However, `Deref` only provides a reference |
1507 | 1507 | /// that lives for as long as the borrow of the `Pin`, not the lifetime of |
1508 | | - /// the `Pin` itself. This method allows turning the `Pin` into a reference |
1509 | | - /// with the same lifetime as the original `Pin`. |
| 1508 | + /// the reference contained in the `Pin`. This method allows turning the `Pin` into a reference |
| 1509 | + /// with the same lifetime as the reference it wraps. |
1510 | 1510 | /// |
1511 | 1511 | /// ["pinning projections"]: self#projections-and-structural-pinning |
1512 | 1512 | #[inline(always)] |
|
0 commit comments