confusable_idents lint diagnostic is confusing #76140
Labels
A-lints
Area: Lints (warnings about flaws in source code) such as unused_mut.
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
If you have a program containing two variables named
ρ
andp
(that is the Greek letter Rho and the English letter P respectively), you'll get a warning like this:This lint is an extremely clever way to detect possible homoglyph issues. However, I think that this message could be worded better to help the programmer if the non-ascii indentifier was actually intentional.
To start, there should be more emphasis that this warning was triggered because the program contains both of the listed identifiers. As far as I know, this is the only lint that can trigger based on the names of local variables in completely non-overlapping scopes and even when they are in completely different modules. Perhaps it could read something like
Additionally, the second code snippet annotation would be better with "other" rather than "previous" since the two usages might not be ordered with respect to each other.
The text was updated successfully, but these errors were encountered: