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