We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
fn main() { let mut a; struct S; (S, a) = (S, ()); // Error (S {}, a) = (S, ()); // Works enum E { A } (E::A, a) = (E::A, ()); // Error (E::A {}, a) = (E::A, ()); // Works }
error[E0070]: invalid left-hand side of assignment --> src/main.rs:4:12 | 4 | (S, a) = (S, ()); // Error | - ^ | | | cannot assign to this expression error[E0070]: invalid left-hand side of assignment --> src/main.rs:7:15 | 7 | (E::A, a) = (E::A, ()); // Error | ---- ^ | | | cannot assign to this expression
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=bf807e599b504f489454388eb27acbbb
The RFC states explicitly we should support them:
https://github.com/rust-lang/rfcs/blob/master/text/2909-destructuring-assignment.md#reference-level-explanation
The class of assignee expressions is defined inductively: Place: place. Underscore: _. Tuples: (assignee, assignee, assignee), (assignee, .., assignee), (.., assignee, assignee), (assignee, assignee, ..). Slices: [assignee, assignee, assignee], [assignee, .., assignee], [.., assignee, assignee], [assignee, assignee, ..]. Tuple structs: path(assignee, assignee, assignee), path(assignee, .., assignee), path(.., assignee, assignee), path(assignee, assignee, ..). Structs: path { field: assignee, field: assignee }, path { field: assignee, field: assignee, .. }. Unit structs: path.
The class of assignee expressions is defined inductively:
place
_
(assignee, assignee, assignee)
(assignee, .., assignee)
(.., assignee, assignee)
(assignee, assignee, ..)
[assignee, assignee, assignee]
[assignee, .., assignee]
[.., assignee, assignee]
[assignee, assignee, ..]
path(assignee, assignee, assignee)
path(assignee, .., assignee)
path(.., assignee, assignee)
path(assignee, assignee, ..)
path { field: assignee, field: assignee }
path { field: assignee, field: assignee, .. }
path
@rustbot label: +F-destructuring_assignment
The text was updated successfully, but these errors were encountered:
@rustbot claim
Sorry, something went wrong.
1b2e0b6
compiler-errors
Successfully merging a pull request may close this issue.
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=bf807e599b504f489454388eb27acbbb
The RFC states explicitly we should support them:
https://github.com/rust-lang/rfcs/blob/master/text/2909-destructuring-assignment.md#reference-level-explanation
@rustbot label: +F-destructuring_assignment
The text was updated successfully, but these errors were encountered: