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

Add help message for static method call of a struct #101637

Closed
chenyukang opened this issue Sep 10, 2022 · 3 comments · Fixed by #103706
Closed

Add help message for static method call of a struct #101637

chenyukang opened this issue Sep 10, 2022 · 3 comments · Fixed by #103706
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints 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

@chenyukang
Copy link
Member

chenyukang commented Sep 10, 2022

struct Demo {}

impl Demo {
    fn func() {}
}

fn main() {
    Dem::func();
}

Current output:

error[E0433]: failed to resolve: use of undeclared type `Dem`
 --> strcuct.rs:8:5
  |
8 |     Dem::func();
  |     ^^^ use of undeclared type `Dem`

error: aborting due to previous error

Expect to have a tip from Levenshtein algorithm.

9 |     Dem::func();
  |     ^^^
help: a struct with a similar name exists
  |
9 |     Demo::func();
  |     ~~~~
@chenyukang
Copy link
Member Author

chenyukang commented Sep 10, 2022

I spent some time to debug it, from the code path, we actually find out Demo with Levenshtein algorithm

let typo_sugg = self.lookup_typo_candidate(path, ns, is_expected);

But didn't add suggestion right in this scenario.

@BGR360
Copy link
Contributor

BGR360 commented Sep 12, 2022

@rustbot label T-compiler A-diagnostics D-terse

@rustbot rustbot added A-diagnostics Area: Messages for errors, warnings, and lints 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. labels Sep 12, 2022
@zbyrn
Copy link
Contributor

zbyrn commented Oct 26, 2022

@rustbot claim

zbyrn added a commit to zbyrn/rust that referenced this issue Oct 27, 2022
@bors bors closed this as completed in 7dc3ace Nov 1, 2022
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-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.

4 participants