-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
confusable_idents lint diagnostic is confusing #76140
Copy link
Copy link
Closed
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
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.