Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support destructuring assignment #11532

Closed
Veykril opened this issue Feb 22, 2022 · 2 comments 路 Fixed by #12428
Closed

Support destructuring assignment #11532

Veykril opened this issue Feb 22, 2022 · 2 comments 路 Fixed by #12428
Labels
A-ty type system / type inference / traits / method resolution C-feature Category: feature request

Comments

@Veykril
Copy link
Member

Veykril commented Feb 22, 2022

Turns out this is getting stabilized in 1.59 (which releases in 2 days 馃槺) and we can't parse this properly yet. RFC text is here https://github.com/rust-lang/rfcs/blob/master/text/2909-destructuring-assignment.md
This will need some syntax/grammar adjustments.

cc #11454

@Veykril Veykril added A-parser parser issues Broken Window Bugs / technical debt to be addressed immediately labels Feb 22, 2022
@ChayimFriedman2
Copy link
Contributor

ChayimFriedman2 commented Feb 24, 2022

Taking this.

Oops, posted too many comments.

bors bot added a commit that referenced this issue Mar 5, 2022
11598: feat: Parse destructuring assignment r=Veykril a=ChayimFriedman2

Part of #11532.

Lowering is not as easy and may not even be feasible right now as it requires generating identifiers: `(a, b) = (b, a)` is desugared into
```rust
{
    let (<gensym_a>, <gensym_b>) = (b, a);
    a = <gensym_a>;
    b = <gensym_b>;
}
```

rustc uses hygiene to implement that, but we don't support hygiene yet.

However, I think parsing was the main problem as lowering will just affect type inference, and while `{unknown}` is not nice it's much better than a syntax error.

I'm still looking for the best way to do lowering, though.

Fixes #11454.

Co-authored-by: Chayim Refael Friedman <chayimfr@gmail.com>
@Veykril Veykril removed the Broken Window Bugs / technical debt to be addressed immediately label Mar 16, 2022
@Veykril
Copy link
Member Author

Veykril commented Mar 16, 2022

Parsing was implemented in #11598, we don't lower this properly yet though.

@jonas-schievink jonas-schievink removed the A-parser parser issues label Mar 31, 2022
@flodiebold flodiebold added A-ty type system / type inference / traits / method resolution C-feature Category: feature request labels Apr 6, 2022
@bors bors closed this as completed in 2ff505a Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ty type system / type inference / traits / method resolution C-feature Category: feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants