File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -350,17 +350,22 @@ as there are many more open questions around them than around just a simpler way
350350
351351## ` async ` interactions
352352
353- We could support using ` await ` in ` gen ` blocks, similar to how we support ` ? ` being used within them.
354- This is not trivially possible due to the fact that ` Iterator::next ` takes ` &mut self ` and not ` Pin<&mut self> ` .
353+ We could support using ` await ` in ` async gen ` blocks, similar to how we support ` ? ` being used within ` gen ` blocks.
354+ This is not possible in general due to the fact that ` Iterator::next ` takes ` &mut self ` and not ` Pin<&mut self> ` , but
355+ it should be possible if no references are held across the ` await ` point, similar to how we disallow holding
356+ references across ` yield ` points in this RFC.
355357
356- There are a few options forward for this:
358+
359+ ## self-referential ` gen ` bloocks
360+
361+ There are a few options forward:
357362
358363* Add a separate trait for pinned iteration that is also usable with ` gen ` and ` for `
359364 * downside: very similar traits for the same thing
360365* backwards compatibly add a way to change the argument type of ` Iterator::next `
361366 * downside: unclear if possible
362367* implement ` Iterator ` for ` Pin<&mut G> ` instead of for ` G ` directly (whatever ` G ` is here, but it could be a ` gen ` block)
363- * downside: the thing being iterated over must now be pinned for the entire iteration, instead of for each iteration
368+ * downside: the thing being iterated over must now be pinned for the entire iteration, instead of for each invocation of ` next ` .
364369
365370## ` try ` interactions
366371
You can’t perform that action at this time.
0 commit comments