2019-12-30 23:46:31 +00:00
|
|
|
error[E0308]: mismatched types
|
|
|
|
--> $DIR/const-in-struct-pat.rs:8:17
|
|
|
|
|
|
|
|
|
LL | struct foo;
|
2022-02-13 15:27:59 +00:00
|
|
|
| ---------- unit struct defined here
|
2019-12-30 23:46:31 +00:00
|
|
|
...
|
|
|
|
LL | let Thing { foo } = t;
|
|
|
|
| ^^^ - this expression has type `Thing`
|
|
|
|
| |
|
2023-01-03 02:00:33 +00:00
|
|
|
| expected `String`, found `foo`
|
2019-12-30 23:46:31 +00:00
|
|
|
| `foo` is interpreted as a unit struct, not a new binding
|
2020-03-12 03:38:21 +00:00
|
|
|
|
|
|
|
|
help: bind the struct field to a different name instead
|
|
|
|
|
|
|
|
|
LL | let Thing { foo: other_foo } = t;
|
2021-06-22 02:07:19 +00:00
|
|
|
| +++++++++++
|
2019-12-30 23:46:31 +00:00
|
|
|
|
2023-11-21 15:44:16 +00:00
|
|
|
error: aborting due to 1 previous error
|
2019-12-30 23:46:31 +00:00
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0308`.
|