Closed
Description
Given the following code
struct foo;
struct Thing { foo: String }
fn example(t: Thing) {
let Thing { foo } = t;
}
generate the following error
error[E0530]: let bindings cannot shadow tuple structs
--> src/lib.rs:5:17
|
1 | struct foo;
| ------------- a unit struct `foo` is defined here
...
5 | let Thing { foo } = t;
| ^^^ cannot be named the same as a unit struct
instead of
error[E0308]: mismatched types
--> src/lib.rs:5:17
|
5 | let Thing { foo } = t;
| ^^^ expected struct `std::string::String`, found struct `foo`
|
= note: expected type `std::string::String`
found type `foo`