Skip to content

Commit 4bf6106

Browse files
committed
Remove incorrect statement about pinning
There was a statement in the draft about, as a downside, something needing to be pinned for the entire iteration rather than just for each call to `next`. But, of course, under the pinning guarantees, these are equivalent. Once something is pinned, unless it is `Unpin`, it must be treated as pinned until it is destructed. Let's remove this statement.
1 parent f6cd712 commit 4bf6106

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

text/3513-gen-blocks.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,6 @@ There are a few options for how to do this, either before or after stabilization
571571
* Backward-compatibly add a way to change the argument type of `Iterator::next`.
572572
* *Downside*: It's unclear whether this is possible.
573573
* Implement `Iterator` for `Pin<&mut G>` instead of for `G` directly (whatever `G` is here, but it could be a `gen` block).
574-
* *Downside*: The thing being iterated over must now be pinned for the entire iteration, instead of for each invocation of `next`.
575574
* *Downside*: Now the `next` method takes a double-indirection as an argument `&mut Pin<&mut G>`, which may not optimize well sometimes.
576575

577576
This RFC is forward compatible with any such designs. However, if we were to stabilize `gen` blocks that could not hold borrows across `yield` points, this would be a serious usability limitation that users might find surprising. Consequently, whether we should choose to address this before stabilization is an open question.

0 commit comments

Comments
 (0)