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

Improve error messages from type parameter shadowing #20729

Closed
huonw opened this issue Jan 8, 2015 · 3 comments
Closed

Improve error messages from type parameter shadowing #20729

huonw opened this issue Jan 8, 2015 · 3 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@huonw
Copy link
Member

huonw commented Jan 8, 2015

#20728 gives the absolute minimum information about shadowed type parameters, just telling you there is one, and which it is. The span is the whole method and so is suboptimal (would be better to point to the specific problematic type parameter), and it would be nice to indicate the shadowed type parameter, similar to the shadowed lifetime warning.

@huonw huonw added the A-diagnostics Area: Messages for errors, warnings, and lints label Jan 8, 2015
@steveklabnik
Copy link
Member

Traige: src/test/compile-fail/shadowed-type-parameter.rs can be used to reproduce, and the span still shows the whole name.

@steveklabnik steveklabnik added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Mar 9, 2017
@estebank
Copy link
Contributor

Current output:

error[E0194]: type parameter `T` shadows another type parameter of the same name
  --> <anon>:18:27
   |
15 | trait Bar<T> {
   |           - first `T` declared here
...
18 |     fn shadow_in_required<T>(&self);
   |                           ^ shadows another type parameter

@Mark-Simulacrum
Copy link
Member

I believe the current output (same as in previous comment) fixes this. Marking as E-needstest, a UI test (moving src/test/compile-fail/shadowed-type-parameter.rs) would be great. I believe this is an easy task, so marking as such -- I can provide mentoring instructions as needed, let me know.

@Mark-Simulacrum Mark-Simulacrum added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. labels Jun 21, 2017
arielb1 pushed a commit to arielb1/rust that referenced this issue Jun 29, 2017
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 E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants