Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Destructuring assignment #372

Copy link
Copy link
@glaebhoerl

Description

@glaebhoerl
Issue body actions

Given

struct Point { x: int, y: int }
fn returns_point(...) -> Point { ... }
fn returns_tuple(...) -> (int, int) { ... }

it would be nice to be able to do things like

let a; let b;
(a, b) = returns_tuple(...);
let c; let d;
Point { x: c, y: d } = returns_point(...);

and not just in lets, as we currently allow.

Perhaps even:

let my_point: Point;
(my_point.x, my_point.y) = returns_tuple(...);

(Most use cases would likely involve mut variables; but those examples would be longer.)

Related issues from the rust repo: rust-lang/rust#10174 rust-lang/rust#12138

BlacklightShining, hayd, SirVer, oli-obk, dashed and 393 moreDavidSouthers97712, DarrienG, nuxlli, ArtAndreev, brooksmtownsend and 2 moredenisandroid, Frederik-Baetens and safinsinghideasman42, petro-rudenko, quininer, burjui, Object905 and 68 moreiorveth, scravy, mohe2015, s97712, egeyar and 3 moredzmitry-lahoda and scorphus

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-expressionsTerm language related proposals & ideasTerm language related proposals & ideasA-syntaxSyntax related proposals & ideasSyntax related proposals & ideasT-langRelevant to the language team, which will review and decide on the RFC.Relevant to the language team, which will review and decide on the RFC.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.