2020-11-11 07:15:15 -06:00
|
|
|
error: expected identifier, found reserved identifier `_`
|
2021-11-03 01:50:57 -05:00
|
|
|
--> $DIR/struct_destructure_fail.rs:11:17
|
2020-11-11 07:15:15 -06:00
|
|
|
|
|
|
|
|
LL | Struct { a, _ } = Struct { a: 1, b: 2 };
|
|
|
|
| ------ ^ expected identifier, found reserved identifier
|
|
|
|
| |
|
|
|
|
| while parsing this struct
|
|
|
|
|
2020-11-07 08:28:55 -06:00
|
|
|
error: functional record updates are not allowed in destructuring assignments
|
2021-11-03 01:50:57 -05:00
|
|
|
--> $DIR/struct_destructure_fail.rs:13:19
|
2020-11-07 08:28:55 -06:00
|
|
|
|
|
|
|
|
LL | Struct { a, ..d } = Struct { a: 1, b: 2 };
|
|
|
|
| ^ help: consider removing the trailing pattern
|
|
|
|
|
2023-05-26 08:49:01 -05:00
|
|
|
error[E0797]: base expression required after `..`
|
2021-11-03 01:50:57 -05:00
|
|
|
--> $DIR/struct_destructure_fail.rs:15:19
|
2020-11-07 08:28:55 -06:00
|
|
|
|
|
|
|
|
LL | Struct { a, .. };
|
2023-05-26 08:49:01 -05:00
|
|
|
| ^
|
|
|
|
|
|
|
|
|
help: add a base expression here
|
|
|
|
|
|
|
|
|
LL | Struct { a, ../* expr */ };
|
|
|
|
| ++++++++++
|
2020-11-07 08:28:55 -06:00
|
|
|
|
|
|
|
error[E0026]: struct `Struct` does not have a field named `c`
|
2021-11-03 01:50:57 -05:00
|
|
|
--> $DIR/struct_destructure_fail.rs:10:20
|
2020-11-07 08:28:55 -06:00
|
|
|
|
|
|
|
|
LL | Struct { a, b, c } = Struct { a: 0, b: 1 };
|
|
|
|
| ^ struct `Struct` does not have this field
|
|
|
|
|
2020-11-11 07:15:15 -06:00
|
|
|
error[E0027]: pattern does not mention field `b`
|
2021-11-03 01:50:57 -05:00
|
|
|
--> $DIR/struct_destructure_fail.rs:11:5
|
2020-11-11 07:15:15 -06:00
|
|
|
|
|
|
|
|
LL | Struct { a, _ } = Struct { a: 1, b: 2 };
|
|
|
|
| ^^^^^^^^^^^^^^^ missing field `b`
|
|
|
|
|
|
|
|
|
help: include the missing field in the pattern
|
|
|
|
|
|
2021-01-26 13:24:43 -06:00
|
|
|
LL | Struct { a, b } = Struct { a: 1, b: 2 };
|
2021-06-21 21:07:19 -05:00
|
|
|
| ~~~~~
|
2020-11-11 07:15:15 -06:00
|
|
|
help: if you don't care about this missing field, you can explicitly ignore it
|
|
|
|
|
|
2024-10-22 00:51:54 -05:00
|
|
|
LL | Struct { a, b: _ } = Struct { a: 1, b: 2 };
|
|
|
|
| ~~~~~~~~
|
|
|
|
help: or always ignore missing fields here
|
|
|
|
|
|
2021-01-26 13:24:43 -06:00
|
|
|
LL | Struct { a, .. } = Struct { a: 1, b: 2 };
|
2021-06-21 21:07:19 -05:00
|
|
|
| ~~~~~~
|
2020-11-11 07:15:15 -06:00
|
|
|
|
|
|
|
error: aborting due to 5 previous errors
|
2020-11-07 08:28:55 -06:00
|
|
|
|
2023-05-26 08:49:01 -05:00
|
|
|
Some errors have detailed explanations: E0026, E0027, E0797.
|
2020-11-11 07:15:15 -06:00
|
|
|
For more information about an error, try `rustc --explain E0026`.
|