about summary refs log tree commit diff
path: root/library/core/src/pin.rs
diff options
context:
space:
mode:
Diffstat (limited to 'library/core/src/pin.rs')
-rw-r--r--library/core/src/pin.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/library/core/src/pin.rs b/library/core/src/pin.rs
index 720317b05e0..ccef35b4532 100644
--- a/library/core/src/pin.rs
+++ b/library/core/src/pin.rs
@@ -1006,9 +1006,10 @@ impl<P, U> DispatchFromDyn<Pin<U>> for Pin<P> where P: DispatchFromDyn<U> {}
 ///  // Allow generator to be self-referential (not `Unpin`)
 ///  // vvvvvv        so that locals can cross yield points.
 ///     static || {
-///         let foo = String::from("foo"); // --+
-///         yield 0;                         // | <- crosses yield point!
-///         println!("{}", &foo); // <----------+
+///         let foo = String::from("foo");
+///         let foo_ref = &foo; // ------+
+///         yield 0;                  // | <- crosses yield point!
+///         println!("{foo_ref}"); // <--+
 ///         yield foo.len();
 ///     }
 /// }