Skip to content

Commit 6d523e9

Browse files
authored
Fix the generator example for pin!()
1 parent 4c60a0e commit 6d523e9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

library/core/src/pin.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1006,9 +1006,10 @@ impl<P, U> DispatchFromDyn<Pin<U>> for Pin<P> where P: DispatchFromDyn<U> {}
10061006
/// // Allow generator to be self-referential (not `Unpin`)
10071007
/// // vvvvvv so that locals can cross yield points.
10081008
/// static || {
1009-
/// let foo = String::from("foo"); // --+
1010-
/// yield 0; // | <- crosses yield point!
1011-
/// println!("{}", &foo); // <----------+
1009+
/// let foo = String::from("foo");
1010+
/// let foo_ref = &foo; // ------+
1011+
/// yield 0; // | <- crosses yield point!
1012+
/// println!("{foo_ref}"); // <--+
10121013
/// yield foo.len();
10131014
/// }
10141015
/// }

0 commit comments

Comments
 (0)