-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Add explicit notion of copyability for closures. #2829
Labels
A-typesystem
Area: The type system
E-hard
Call for participation: Hard difficulty. Experience needed to fix: A lot.
Milestone
Comments
This will also have problems with the new proposed task builder interface (and also, if i'm not mistaken, with the old one too!). This will fail:
This will not fail but should:
|
|
Yeah, as long as #2549 stays open, this doesn't need to be open. |
celinval
pushed a commit
to celinval/rust-dev
that referenced
this issue
Jun 4, 2024
Update Rust toolchain from nightly-2023-10-17 to nightly-2023-10-18 without any other source changes. This is an automatically generated pull request. If any of the CI checks fail, manual intervention is required. In such a case, review the changes at https://github.com/rust-lang/rust from rust-lang@49691b1 up to rust-lang@09df610.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-typesystem
Area: The type system
E-hard
Call for participation: Hard difficulty. Experience needed to fix: A lot.
Proposal: A closure is copyable iff everything in its environment is copyable. Furthermore, non-copyable ("one-shot") closures are allowed to capture and de-initialise outer variables.
This will allow building closures that run destructors for you. It will also fix #2828.
Closures' types can then be written with copy and send traits.
fn x(f: fn()) { f(); f(); }
will no longer be legal; you have to writefn x(f: fn()<copy>)
or some-such.The text was updated successfully, but these errors were encountered: