-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
"No item found" diagnostic should suggest items that differ by case #86170
Comments
@rustbot label +C-enhancement +D-newcomer-roadblock |
This only doesn't Just Work because the Levenshtein thing is case sensitive, right? There is some special-casing for case-insensitive suggestions but afaict it only applies if the case-sensitive Levenshtein distance is also already low, which seems wrong at first glance. |
im working on this |
Okay, judging by rust/compiler/rustc_span/src/lev_distance/tests.rs Lines 40 to 42 in d192c80
Edit: Okay, maybe that test case didn't really care. The use of case-insensitive match as tie breaker for equal levenshtein distance only was introduced with #46347 (comment) afaict. |
…match-names, r=estebank Suggest a case insensitive match name regardless of levenshtein distance Fixes rust-lang#86170 Currently, `find_best_match_for_name` only returns a case insensitive match name depending on a Levenshtein distance. It's a bit unfortunate that that hides some suggestions for typos like `Bar` -> `BAR`. That idea is from rust-lang#46347 (comment), but I think it still makes some sense to show a candidate when we find a case insensitive match name as it's more like a typo. Skipped the `candidate != lookup` check because the current (i.e, `levenshtein_match`) returns the exact same `Symbol` anyway but it doesn't seem to confuse anything on UI tests. r? `@estebank`
Given the following code: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=a494a5e7386a6c9e55f7f39695dece41
The current output is:
Ideally the output should include a note suggesting the variant with the same name (but different case):
The text was updated successfully, but these errors were encountered: