-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tracking issue for RFC 2132: copy_closures/clone_closures #44490
Comments
I believe that @scalexm has implemented this RFC already. =) |
@nmatsakis That was for tuples, not for closures. |
Implement `Copy`/`Clone` for closures Implement RFC [#2132](rust-lang/rfcs#2132) (tracking issue: #44490). NB: I'm not totally sure about the whole feature gates thing, that's my first PR of this kind...
(I think we can tick the first box) |
What do we want to do around stabilization here? @cramertj was floating the idea of stabilizing only the clone impl for closures, not the copy one, at least until such time as we have a workable "unexpected copy" lint that would push you to invoke Personally, I think I'd be ok stabilizing copy/clone closures in their entirety, but we probably want to see a bit more usage in the wild. Can anyone report on using this feature? |
I've been messing with it in some personal stuff, and I've really enjoyed having the feature. I'd be in favor of stabilizing both |
Any plans to extend this to support cloning generators as well? |
I haven't used this directly yet, but I can definitely report that people have complained to me that we don't have this feature on stable yet because it's unnecessarily forced them to change their design. It solves one of those irritating "when you want it, you really want it" problems, imo. :) |
What's the status on this? Is it ready to stabilize once docs are ready? I'm planning a rewrite of some closure-related docs in the reference, so if this is going in, I'll include that. |
@rfcbot fcp merge I propose to stabilize the The following examples demonstrate that the feature is working as intended. The RFC specifies that non- The RFC specifies that non- The RFC specifies that One mentioned drawback of the RFC is that cloned |
Team member @cramertj has proposed to merge this. The next step is review by the rest of the tagged teams: No concerns currently listed. Once a majority of reviewers approve (and none object), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
"The RFC specifies that non- "The RFC specifies that non- This omits the case where a capture of a I believe this is the correct behaviour, but wanted to draw attention to it anyway. |
Yes, you're correct-- I should have said non-move closures which do not mutate or move captured variables are copy. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
The final comment period is now complete. |
I marked as E-mentor -- looks like we're ready for a stabilization PR here, right? There are instructions on the forge. |
The reference is already updated. RBE probably doesn't need updating, the stdlib could maybe use mention on |
@alercah sounds right |
Stabilization PR (with mention in docs for |
Stabilize the copy_closures and clone_closures features In addition to the `Fn*` family of traits, closures now implement `Copy` (and similarly `Clone`) if all of the captures do. Tracking issue: rust-lang#44490
Stabilize the copy_closures and clone_closures features In addition to the `Fn*` family of traits, closures now implement `Copy` (and similarly `Clone`) if all of the captures do. Tracking issue: rust-lang#44490
#49299 is merged, I think this is it. Let me know if I forgot something relevant to this tracking issue. |
This is a tracking issue for the RFC "Copy/Clone Closures" (rust-lang/rfcs#2132).
Steps:
The text was updated successfully, but these errors were encountered: