-
Notifications
You must be signed in to change notification settings - Fork 14k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-destructuring_assignment`#![feature(destructuring_assignment)]``#![feature(destructuring_assignment)]`
Description
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
The RFC states explicitly we should support them:
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.
@rustbot label: +F-destructuring_assignment
runiqcompiler-errors
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-destructuring_assignment`#![feature(destructuring_assignment)]``#![feature(destructuring_assignment)]`