Skip to content

Commit 936ceb2

Browse files
committedJan 7, 2024
lifetime -> lifespan where relevant. improve docs on as_ref()
1 parent 0050676 commit 936ceb2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed
 

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

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
//! 2. More generally, remain *valid* at that same memory location
1010
//!
1111
//! 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
1313
//! location in memory, as though pinned to a pinboard. Pinning a value is incredibly useful in
1414
//! that it provides the necessary guarantees[^guarantees] for [`unsafe`] code to be able to
1515
//! dereference raw pointers to the pinned value for the duration it is pinned (which,
1616
//! [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
1818
//! interfaces on top of things like self-referential types and intrusive data structures which
1919
//! cannot currently be modeled in fully safe Rust using only borrow-checked
2020
//! [references][reference].
@@ -126,7 +126,7 @@
126126
//! [`Pin`] is specifically targeted at allowing the implementation of *safe interfaces* around
127127
//! types which have some state during which they become "address-sensitive." A value in such an
128128
//! "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
130130
//! interface is relying on those invariants to be true in order for its implementation to be sound.
131131
//!
132132
//! As a motivating example of a type which may become address-sensitive, consider a type which
@@ -535,7 +535,7 @@
535535
//! but it also implies that,
536536
//!
537537
//! 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
539539
//!
540540
//! This point is subtle but required for intrusive data structures to be implemented soundly.
541541
//!
@@ -1505,8 +1505,8 @@ impl<'a, T: ?Sized> Pin<&'a T> {
15051505
/// Note: `Pin` also implements `Deref` to the target, which can be used
15061506
/// to access the inner value. However, `Deref` only provides a reference
15071507
/// 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.
15101510
///
15111511
/// ["pinning projections"]: self#projections-and-structural-pinning
15121512
#[inline(always)]

0 commit comments

Comments
 (0)