File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -618,14 +618,16 @@ unsafe impl<T: ?Sized> Freeze for &mut T {}
618618/// So this, for example, can only be done on types implementing `Unpin`:
619619///
620620/// ```rust
621- /// use std::mem::replace ;
621+ /// use std::mem;
622622/// use std::pin::Pin;
623623///
624624/// let mut string = "this".to_string();
625625/// let mut pinned_string = Pin::new(&mut string);
626626///
627- /// // dereferencing the pointer mutably is only possible because String implements Unpin
628- /// replace(&mut *pinned_string, "other".to_string());
627+ /// // We need a mutable reference to call `mem::replace`.
628+ /// // We can obtain such a reference by (implicitly) invoking `Pin::deref_mut`,
629+ /// // but that is only possible because `String` implements `Unpin`.
630+ /// mem::replace(&mut *pinned_string, "other".to_string());
629631/// ```
630632///
631633/// This trait is automatically implemented for almost every type.
You can’t perform that action at this time.
0 commit comments