]> git.lizzy.rs Git - rust.git/blob - src/test/ui/destructuring-assignment/tuple_struct_destructure_fail.stderr
Rollup merge of #105758 - Nilstrieb:typeck-results-mod, r=compiler-errors
[rust.git] / src / test / ui / destructuring-assignment / tuple_struct_destructure_fail.stderr
1 error: `..` can only be used once per tuple struct or variant pattern
2   --> $DIR/tuple_struct_destructure_fail.rs:23:27
3    |
4 LL |     TupleStruct(a, .., b, ..) = TupleStruct(0, 1);
5    |                    --     ^^ can only be used once per tuple struct or variant pattern
6    |                    |
7    |                    previously used here
8
9 error: `..` can only be used once per tuple struct or variant pattern
10   --> $DIR/tuple_struct_destructure_fail.rs:25:35
11    |
12 LL |     Enum::SingleVariant(a, .., b, ..) = Enum::SingleVariant(0, 1);
13    |                            --     ^^ can only be used once per tuple struct or variant pattern
14    |                            |
15    |                            previously used here
16
17 error[E0023]: this pattern has 3 fields, but the corresponding tuple struct has 2 fields
18   --> $DIR/tuple_struct_destructure_fail.rs:28:17
19    |
20 LL | struct TupleStruct<S, T>(S, T);
21    |                          -  - tuple struct has 2 fields
22 ...
23 LL |     TupleStruct(a, a, b) = TupleStruct(1, 2);
24    |                 ^  ^  ^ expected 2 fields, found 3
25
26 error[E0023]: this pattern has 1 field, but the corresponding tuple struct has 2 fields
27   --> $DIR/tuple_struct_destructure_fail.rs:30:17
28    |
29 LL | struct TupleStruct<S, T>(S, T);
30    |                          -  - tuple struct has 2 fields
31 ...
32 LL |     TupleStruct(_) = TupleStruct(1, 2);
33    |                 ^ expected 2 fields, found 1
34    |
35 help: use `_` to explicitly ignore each field
36    |
37 LL |     TupleStruct(_, _) = TupleStruct(1, 2);
38    |                  +++
39 help: use `..` to ignore all fields
40    |
41 LL |     TupleStruct(..) = TupleStruct(1, 2);
42    |                 ~~
43
44 error[E0023]: this pattern has 3 fields, but the corresponding tuple variant has 2 fields
45   --> $DIR/tuple_struct_destructure_fail.rs:32:25
46    |
47 LL |     SingleVariant(S, T)
48    |                   -  - tuple variant has 2 fields
49 ...
50 LL |     Enum::SingleVariant(a, a, b) = Enum::SingleVariant(1, 2);
51    |                         ^  ^  ^ expected 2 fields, found 3
52
53 error[E0023]: this pattern has 1 field, but the corresponding tuple variant has 2 fields
54   --> $DIR/tuple_struct_destructure_fail.rs:34:25
55    |
56 LL |     SingleVariant(S, T)
57    |                   -  - tuple variant has 2 fields
58 ...
59 LL |     Enum::SingleVariant(_) = Enum::SingleVariant(1, 2);
60    |                         ^ expected 2 fields, found 1
61    |
62 help: use `_` to explicitly ignore each field
63    |
64 LL |     Enum::SingleVariant(_, _) = Enum::SingleVariant(1, 2);
65    |                          +++
66 help: use `..` to ignore all fields
67    |
68 LL |     Enum::SingleVariant(..) = Enum::SingleVariant(1, 2);
69    |                         ~~
70
71 error[E0070]: invalid left-hand side of assignment
72   --> $DIR/tuple_struct_destructure_fail.rs:38:12
73    |
74 LL |     test() = TupleStruct(0, 0);
75    |     ------ ^
76    |     |
77    |     cannot assign to this expression
78
79 error[E0070]: invalid left-hand side of assignment
80   --> $DIR/tuple_struct_destructure_fail.rs:40:14
81    |
82 LL |     (test)() = TupleStruct(0, 0);
83    |     -------- ^
84    |     |
85    |     cannot assign to this expression
86
87 error[E0070]: invalid left-hand side of assignment
88   --> $DIR/tuple_struct_destructure_fail.rs:42:38
89    |
90 LL |     <Alias::<isize> as Test>::test() = TupleStruct(0, 0);
91    |     -------------------------------- ^
92    |     |
93    |     cannot assign to this expression
94
95 error: aborting due to 9 previous errors
96
97 Some errors have detailed explanations: E0023, E0070.
98 For more information about an error, try `rustc --explain E0023`.