]> git.lizzy.rs Git - rust.git/blob - src/test/ui/destructuring-assignment/note-unsupported.rs
Auto merge of #106349 - LeSeulArtichaut:dyn-star-tracking-issue, r=jackh726
[rust.git] / src / test / ui / destructuring-assignment / note-unsupported.rs
1 struct S { x: u8, y: u8 }
2
3 fn main() {
4     let (a, b) = (1, 2);
5
6     (a, b) = (3, 4);
7     (a, b) += (3, 4); //~ ERROR invalid left-hand side of assignment
8     //~| ERROR binary assignment operation `+=` cannot be applied
9
10     [a, b] = [3, 4];
11     [a, b] += [3, 4]; //~ ERROR invalid left-hand side of assignment
12     //~| ERROR binary assignment operation `+=` cannot be applied
13
14     let s = S { x: 3, y: 4 };
15
16     S { x: a, y: b } = s;
17     S { x: a, y: b } += s; //~ ERROR invalid left-hand side of assignment
18     //~| ERROR binary assignment operation `+=` cannot be applied
19
20     S { x: a, ..s } = S { x: 3, y: 4 };
21     //~^ ERROR functional record updates are not allowed in destructuring assignments
22 }