Uh oh!
There was an error while loading. Please reload this page.
Allow generators to impl Clone/Copy - #95137
Conversation
This comment has been minimized.
This comment has been minimized.
oli-obk
left a comment
There was a problem hiding this comment.
I'd like to see some tests on various kinds of async blocks, too. Even if we're just testing the diagnostics that way.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
canndrew
commented
Apr 10, 2022
Sorry for the delay. I've done the requested changes. |
This comment has been minimized.
This comment has been minimized.
Move it to the list of features with no tracking issue, since it has no tracking issue.
canndrew
commented
Apr 10, 2022
I've also added a test which checks that feature(generator_clone) doesn't interfere with the clonability of |
| let all = substs | ||
| .as_generator() | ||
| .upvar_tys() | ||
| .chain(iter::once(substs.as_generator().witness())) | ||
| .collect::<Vec<_>>(); |
There was a problem hiding this comment.
Not due to this PR, but I really wish we had ways to track where an inference var got resolved and then bubble this span up here. In the current design there is no way to point at the local that causes the generator to stop being clone/copy, all we can do is keep pointing at the entire generator :(
bors
commented
May 15, 2022
☔ The latest upstream changes (presumably #96883) made this pull request unmergeable. Please resolve the merge conflicts. |
oli-obk
commented
Jun 11, 2022
Oof I forgot about this. Changed the label so it shows up in my queue |
oli-obk
commented
Jun 21, 2022
ok, did another pass. This lgtm now. r=me after a rebase |
oli-obk
commented
Jun 21, 2022
@rustbot author |
JohnCSimon
commented
Jul 24, 2022
ping from triage: FYI: when a PR is ready for review, send a message containing |
JohnCSimon
commented
Sep 11, 2022
Allow generators to impl Clone/Copy Revives rust-lang#95137. It's a pity that the original pr didn't land because the implementation is almost complete! All credits goes to `@canndrew,` and i just resolved the merge conflicts and updated the feature gate version number. r? `@oli-obk`
This PR allows generators to implement
Clone/Copyif all their upvars and all their locals which are held across a yield implementClone/Copy. This only applies to non-staticgenerators, and so excludes generators which contain self-references and the generators thatasyncblocks/fns desugar to,r? @oli-obk