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

Suggest setting associated type when type argument is given instead #48288

Closed
wants to merge 1 commit into from

Conversation

estebank
Copy link
Contributor

When finding too many type arguments and too few associated types,
suggest using associated types in the appropriate place instead.

Fix #20977.

@rust-highfive
Copy link
Collaborator

r? @eddyb

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 17, 2018
When finding too many type arguments and too few associated types,
suggest using associated types in the appropriate place instead.
@estebank
Copy link
Contributor Author

WIP: it would be ideal to present only one error instead of two, specially in the case of only one associated type missing and one unnecessary type argument being present.

@estebank estebank added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 20, 2018
@eddyb
Copy link
Member

eddyb commented Feb 23, 2018

r? @nikomatsakis

@rust-highfive rust-highfive assigned nikomatsakis and unassigned eddyb Feb 23, 2018
@shepmaster
Copy link
Member

Ping from triage, @estebank! Any progress on this to report?

@estebank
Copy link
Contributor Author

estebank commented Mar 2, 2018

I will be picking this up during the weekend. I am unhappy with the current output as it doesn't take associated items into account when creating the diagnostic, so there are cases where the extra help is wrong. I haven't "fixed" the tests that are broken to avoid this getting merged by accident.

@pietroalbini
Copy link
Member

Ping from triage @estebank! Have you worked on this recently?

@estebank
Copy link
Contributor Author

I've been kind of busy. I'll get back to it soon, but if you wish to close to keep the backlog clean, go ahead.

bors added a commit that referenced this pull request Nov 23, 2018
Suggest correct syntax when writing type arg instead of assoc type

- When confusing an associated type with a type argument, suggest the appropriate syntax. Given `Iterator<isize>`, suggest `Iterator<Item = isize>`.
- When encountering multiple missing associated types, emit only one diagnostic.
- Point at associated type def span for context.
- Point at each extra type argument.

Follow up to #48288, fix #20977.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants