Just call clone (or alias)
12 days ago
- #Ergonomics
- #Rust
- #Programming
- Proposal introduces 'just call clone (or alias)' to simplify Rust's ergonomic ref-counting.
- Compiler will remove redundant clone/alias calls and automatically capture them in move closures.
- Aims to simplify the mental model for fixing 'use of moved value' errors by standardizing on clone/alias calls.
- Introduces 'last-use transformation' to optimize away unnecessary clones/aliases, replacing them with moves where possible.
- Designed to be a zero-cost abstraction, ensuring no performance penalty for unused features and optimal performance for used ones.
- Addresses concerns around explicit capture clauses and the subtlety of when aliases are created in closures/futures.
- Includes a detailed FAQ covering potential edge cases, execution order subtleties, and the impact on destructor timing.
- Proposal emphasizes the balance between low-level control and ergonomic usability, targeting both new and experienced Rust users.