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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using underscore to ignore elements in a destructuring tuple assignment is flagged as a syntax error #11454

Closed
rben01 opened this issue Feb 11, 2022 · 1 comment · Fixed by #11598
Labels
A-parser parser issues

Comments

@rben01
Copy link

rben01 commented Feb 11, 2022

rust-analyzer version: ba3305480 2022-02-07 stable

rustc version: rustc 1.60.0-nightly (08df8b81d 2022-01-30)

When using tuple destructuring assignment without a let, i.e., when assigning to existing variables and not binding new variables, RA incorrectly flags it as a syntax error. The code below actually compiles fine.

let x;
let y;
(x, _, y, _) = (1, 2, 3, 4); // <-- half of this line is flagged with various "expected X" errors

// not flagged
let (x, _, y, _) = (1, 2, 3, 4);
@Veykril
Copy link
Member

Veykril commented Feb 11, 2022

I think we don't support destructuring assignment at all yet, so this gets parsed as a binary expression with the LHS being parsed as an expression as well.
(I believe there is an issue about that already but I can't find it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-parser parser issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants