-
Notifications
You must be signed in to change notification settings - Fork 56
Experiment with ergonomic ref-counting #107
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
Comments
This issue is intended for status updates only. For general questions or comments, please contact the owner(s) directly. |
This issue has not seen many updates, but there has been definite progress:
|
Year-end summary: In 2024H2 @spastorino began work on an experimental implementation (not yet landed) and @joshtriplett authored a corresponding RFC (rust-lang/rfcs#3680), which has received substantial feedback. We opened a proposed 2025H1 project goal to continue by (a) landing the experimental branch and (b) addressing feedback on the RFC, reading it with the lang-team, and reaching a decision. |
This is a continuing project goal, and the updates below this comment will be for the new period 2025h1 |
There's a PR up rust-lang/rust#134797 which implements the proposed RFC without the optimizations. |
Update: rust-lang/rust#134797 has landed. Semantics as implemented in the PR:
Next steps:
Notable decisions made and discussions:
|
TL;DR: There is now an early prototype available that allows you to write |
In reviewing rust-lang/rust#138628, we realized that the tests were not behaving as expected because they were running in Rust 2015 which had distinct capture rules. My suggestion was to limit the There is an interesting tension with Rust should feel like one language. My feeling is that there is a missing tenet: the reason we do editions and not fine-grained features is because we wish to avoid combianotoric explosion, where odd combinations of features can lead to untested scenarios. But that is exactly what would be happening here if we allow Put another way, you should never have to go back and modify an edition migration to work differently. That suggestions you are attempting to push the feature too far back. |
We've modified codegen so that we guarantee that We are not working on convert |
Uh oh!
There was an error while loading. Please reload this page.
Summary
use
syntax for ergonomic ref-counting.Tasks and status
x.use
anduse ||
syntax andUseCloned
trait (Ergonomic ref counting rust#134797).x.use
will do a copy ifX: Copy
is true after monomorphization. Right now the desugaring toclone
occurs before monomorphization and hence it will call theclone
method even for those instances whereX
is aCopy
type.x.use
to a move rather than a clone if this is a last-use.x
equivalent tox.use
but with an (allow-by-default) lint to signal that something special is happened.The text was updated successfully, but these errors were encountered: