-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
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`
petrochenkov
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.