Repository navigation
Tracking Issue for move expressions (move(expr)) #155050
Description
This is a tracking issue for move(expr) in closures.
The feature gate for the issue is #![feature(move_expr)].
RFC: rust-lang/rfcs#3968
Relevant prior discussion / implementation PR: #132290.
About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g. bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Discussion comments will get marked as off-topic or deleted.
Repeated discussions on the tracking issue may lead to the tracking issue getting locked.
Summary
move_expr adds syntax of the form move(expr) for explicit by-value capture in closures.
The current implementation effort is intentionally starting with plain closures first.
Async / coroutine-related cases are expected to follow separately.
Steps
- Create an RFC for
move_expr - Implement
move(expr)for plain closures Introduce move expressions (move($expr)) #155023 - Implement async / coroutine-related cases Support move expressions in coroutine closures #157738
- Add and expand UI / borrowck / nested-closure test coverage
- Adjust documentation (see instructions on rustc-dev-guide)
- Style updates for any new syntax (nightly-style-procedure)
- Style team decision on new formatting
- Formatting for new syntax has been added to the Style Guide
- (non-blocking) Formatting has been implemented in
rustfmt
- Stabilization PR (see instructions on rustc-dev-guide)
Unresolved Questions
- Async and coroutine cases: What should the semantics be for async blocks and coroutine-related lowering?
- Nested closures: Are the current expected bahavior of nested-closure the right ones in practice, or do they need adjustment?
- Diagnostics and linting: For accepted but potentially confusing cases, such as shadowing or label-related behavior, should we keep the behavior as-is, improve diagnostics, or add a dedicated lint?
- Control-flow-sensitive expressions: How should
move(expr)interact with expressions likebreak, where the desugaring evaluates the expression at closure creation time?
Implementation history
- Introduce move expressions (
move($expr)) #155023 - Support move expressions in coroutine closures #157738
Activity
[-]Tracking Issue for move expressions `move(expr)`[/-][+]Tracking Issue for move expressions (`move(expr)`)[/+]Auto merge of #155023 - TaKO8Ki:move-expr-1, r=nikomatsakis
Auto merge of #155023 - TaKO8Ki:move-expr-1, r=nikomatsakis
Auto merge of #155023 - TaKO8Ki:move-expr-1, r=nikomatsakis
Rollup merge of rust-lang#155023 - TaKO8Ki:move-expr-1, r=nikomatsakis
Rollup merge of rust-lang#155023 - TaKO8Ki:move-expr-1, r=nikomatsakis
Unrolled build for #155023
Rollup merge of #155023 - TaKO8Ki:move-expr-1, r=nikomatsakis
Rollup merge of rust-lang#155023 - TaKO8Ki:move-expr-1, r=nikomatsakis
Rollup merge of #155023 - TaKO8Ki:move-expr-1, r=nikomatsakis
Rollup merge of rust-lang#157738 - TaKO8Ki:move-expr-coroutine-closur…
Rollup merge of rust-lang#157738 - TaKO8Ki:move-expr-coroutine-closur…
Unrolled build for #157738 in rollup 162503
Rollup merge of rust-lang#163940 - fmease:move-expr-is-bottom-not-pre…
Rollup merge of rust-lang#163940 - fmease:move-expr-is-bottom-not-pre…
Rollup merge of rust-lang#163940 - fmease:move-expr-is-bottom-not-pre…
Rollup merge of rust-lang#163940 - fmease:move-expr-is-bottom-not-pre…
Rollup merge of rust-lang#163940 - fmease:move-expr-is-bottom-not-pre…
Unrolled build for #163940 in rollup 164322
Rollup merge of #163940 - fmease:move-expr-is-bottom-not-prefix, r=Ta…