diff options
| author | Daniel Henry-Mantilla <daniel.henry.mantilla@gmail.com> | 2022-01-22 14:47:49 +0100 |
|---|---|---|
| committer | Daniel Henry-Mantilla <daniel.henry.mantilla@gmail.com> | 2022-02-14 17:27:32 +0100 |
| commit | 54e443dceb8d7eb11553fe19ea1fcaf5eedc9004 (patch) | |
| tree | 297c62a71a602d07feb6a9e907a504ed4a04d202 | |
| parent | 5360469b8d6d2e3cac52c2d145df38aca763c61d (diff) | |
| download | rust-54e443dceb8d7eb11553fe19ea1fcaf5eedc9004.tar.gz rust-54e443dceb8d7eb11553fe19ea1fcaf5eedc9004.zip | |
Improve documentation.
Co-Authored-By: Mara Bos <m-ou.se@m-ou.se>
| -rw-r--r-- | library/core/src/pin.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/library/core/src/pin.rs b/library/core/src/pin.rs index 450ff752dab..90f4a5390e7 100644 --- a/library/core/src/pin.rs +++ b/library/core/src/pin.rs @@ -910,8 +910,9 @@ impl<P, U> CoerceUnsized<Pin<U>> for Pin<P> where P: CoerceUnsized<U> {} #[stable(feature = "pin", since = "1.33.0")] impl<P, U> DispatchFromDyn<Pin<U>> for Pin<P> where P: DispatchFromDyn<U> {} -/// Constructs a <code>[Pin]<[&mut] T></code>, by pinning[^1] a `value: T` _locally_[^2] -/// (≠ [in the heap][`Box::pin`]). +/// Constructs a <code>[Pin]<[&mut] T></code>, by pinning[^1] a `value: T` _locally_[^2]. +/// +/// Unlike [`Box::pin`], this does not involve a heap allocation. /// /// [^1]: If the (type `T` of the) given value does not implement [`Unpin`], then this /// effectively pins the `value` in memory, where it will be unable to be moved. @@ -1043,8 +1044,7 @@ impl<P, U> DispatchFromDyn<Pin<U>> for Pin<P> where P: DispatchFromDyn<U> {} /// /// <details><summary>Error message</summary> /// -/// ```rust -/// # const _IGNORE: &str = stringify! { +/// ```console /// error[E0716]: temporary value dropped while borrowed /// --> src/main.rs:9:28 /// | @@ -1056,8 +1056,7 @@ impl<P, U> DispatchFromDyn<Pin<U>> for Pin<P> where P: DispatchFromDyn<U> {} /// 11 | }; // <- Foo is dropped /// | - temporary value is freed at the end of this statement /// | -/// = note: consider using a let binding to create a longer lived value -/// # }; +/// = note: consider using a `let` binding to create a longer lived value /// ``` /// /// </details> |
