Skip to content

Commit 54e443d

Browse files
Improve documentation.
Co-Authored-By: Mara Bos <[email protected]>
1 parent 5360469 commit 54e443d

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

library/core/src/pin.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -910,8 +910,9 @@ impl<P, U> CoerceUnsized<Pin<U>> for Pin<P> where P: CoerceUnsized<U> {}
910910
#[stable(feature = "pin", since = "1.33.0")]
911911
impl<P, U> DispatchFromDyn<Pin<U>> for Pin<P> where P: DispatchFromDyn<U> {}
912912

913-
/// Constructs a <code>[Pin]<[&mut] T></code>, by pinning[^1] a `value: T` _locally_[^2]
914-
/// (≠ [in the heap][`Box::pin`]).
913+
/// Constructs a <code>[Pin]<[&mut] T></code>, by pinning[^1] a `value: T` _locally_[^2].
914+
///
915+
/// Unlike [`Box::pin`], this does not involve a heap allocation.
915916
///
916917
/// [^1]: If the (type `T` of the) given value does not implement [`Unpin`], then this
917918
/// 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> {}
10431044
///
10441045
/// <details><summary>Error message</summary>
10451046
///
1046-
/// ```rust
1047-
/// # const _IGNORE: &str = stringify! {
1047+
/// ```console
10481048
/// error[E0716]: temporary value dropped while borrowed
10491049
/// --> src/main.rs:9:28
10501050
/// |
@@ -1056,8 +1056,7 @@ impl<P, U> DispatchFromDyn<Pin<U>> for Pin<P> where P: DispatchFromDyn<U> {}
10561056
/// 11 | }; // <- Foo is dropped
10571057
/// | - temporary value is freed at the end of this statement
10581058
/// |
1059-
/// = note: consider using a let binding to create a longer lived value
1060-
/// # };
1059+
/// = note: consider using a `let` binding to create a longer lived value
10611060
/// ```
10621061
///
10631062
/// </details>

0 commit comments

Comments
 (0)