Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Point at type parameter shadowing another type in E0574 #97459

Closed
estebank opened this issue May 27, 2022 · 0 comments · Fixed by #103111
Closed

Point at type parameter shadowing another type in E0574 #97459

estebank opened this issue May 27, 2022 · 0 comments · Fixed by #103111
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints D-confusing Diagnostics: Confusing error or lint that should be reworked. D-papercut Diagnostics: An error or lint that needs small tweaks. D-terse Diagnostics: An error or lint that doesn't give enough information about the problem at hand. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@estebank
Copy link
Contributor

estebank commented May 27, 2022

When a type parameter shadows a type name in a pattern, E0574 should point at the type parameter and check if there are other types that could be resolved with the same name and point at them as well.

It currently is

error[E0574]: expected struct, variant or union type, found type parameter `Irrelevant`
  --> src/lib.rs:10:13
   |
10 |             Irrelevant { irrelevant } => {
   |             ^^^^^^^^^^ not a struct, variant or union type

and should be

error[E0574]: expected struct, variant or union type, found type parameter `Irrelevant`
  --> src/lib.rs:10:13
   | 
 3 | pub struct Irrelevant<Irrelevant> {
   |            ---------- you might have meant to refer to this struct
...     
 7 |   impl<Irrelevant: Debug> Debug for Irrelevant<Irrelevant> {
   |        ---------- found this type parameter
...
10 |             Irrelevant { irrelevant } => {
   |             ^^^^^^^^^^ not a struct, variant or union type
@estebank estebank added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. D-confusing Diagnostics: Confusing error or lint that should be reworked. D-papercut Diagnostics: An error or lint that needs small tweaks. D-terse Diagnostics: An error or lint that doesn't give enough information about the problem at hand. labels May 27, 2022
@cjgillot cjgillot self-assigned this May 27, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Aug 17, 2022
…adowing-another-type, r=estebank

Point at a type parameter shadowing another type

This patch fixes a part of rust-lang#97459.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Aug 17, 2022
…adowing-another-type, r=estebank

Point at a type parameter shadowing another type

This patch fixes a part of rust-lang#97459.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Aug 18, 2022
…adowing-another-type, r=estebank

Point at a type parameter shadowing another type

This patch fixes a part of rust-lang#97459.
@bors bors closed this as completed in 41a1cfd Oct 21, 2022
bors pushed a commit to rust-lang-ci/rust that referenced this issue Jan 9, 2023
…adowing-another-type, r=estebank

Point at a type parameter shadowing another type

This patch fixes a part of rust-lang#97459.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints D-confusing Diagnostics: Confusing error or lint that should be reworked. D-papercut Diagnostics: An error or lint that needs small tweaks. D-terse Diagnostics: An error or lint that doesn't give enough information about the problem at hand. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants