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

Fix bad suggestions when initializing enum as struct #99357

Closed
wants to merge 1 commit into from

Conversation

danobi
Copy link
Contributor

@danobi danobi commented Jul 17, 2022

Fix bad suggestions by adding a new heuristic where we assume correct
intent when there's an exact match on an in-scope identifier.

Fix bad suggestions by adding a new heuristic where we assume correct
intent when there's an exact match on an in-scope identifier.
@rust-highfive
Copy link
Collaborator

r? @estebank

(rust-highfive has picked a reviewer for you, use r? to override)

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jul 17, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 17, 2022
@estebank
Copy link
Contributor

I'm not entirely sure this is the right heuristic we should be using here. A better approach would be to check what kind of literal is being tried to be used (struct/tuple/unit?) and see if the field names/count/types match, in order to determine whether we've found an "exact" match. I'm looking at some of the changes and instead of suggesting importing the right Foo, we only emit a suggestion for Foos, which isn't really the best suggestion we can give there.

@bors
Copy link
Contributor

bors commented Aug 18, 2022

☔ The latest upstream changes (presumably #100708) made this pull request unmergeable. Please resolve the merge conflicts.

@estebank
Copy link
Contributor

@danobi would you have time to try and address the comments?

@danobi
Copy link
Contributor Author

danobi commented Aug 18, 2022

Hi @estebank , been a bit busy with a move recently. I hope to find some time to revisit this soon. But if anyone wants to take this PR and fix it up, please feel free.

@estebank
Copy link
Contributor

@danobi, no rush.

@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 Aug 19, 2022
@JohnCSimon
Copy link
Member

Ping from triage:
@danobi What is the status of this PR?

@JohnCSimon
Copy link
Member

@danobi
Ping from triage: I'm closing this due to inactivity, Please reopen when you are ready to continue with this.
Note: if you do please open the PR BEFORE you push to it, else you won't be able to reopen - this is a quirk of github.
Thanks for your contribution.

@rustbot label: +S-inactive

@JohnCSimon JohnCSimon closed this Nov 27, 2022
@rustbot rustbot added the S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. label Nov 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants