Skip to content

Tracking Issue for move expressions (move(expr)) #155050

@TaKO8Ki

Description

@TaKO8Ki

This is a tracking issue for move(expr) in closures.
The feature gate for the issue is #![feature(move_expr)].

An RFC is expected to be created later.
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

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 like break, where the desugaring evaluates the expression at closure creation time?

Implementation history

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions