-
-
Notifications
You must be signed in to change notification settings - Fork 15k
Wrong messages from compiler confusing methods with the same name from different traits #143740
Copy link
Copy link
Closed
Closed
Copy link
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-method-lookupArea: Method lookup (typeck, post `rustc_resolve`, not to be confused with `A-resolve`)Area: Method lookup (typeck, post `rustc_resolve`, not to be confused with `A-resolve`)D-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.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-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-method-lookupArea: Method lookup (typeck, post `rustc_resolve`, not to be confused with `A-resolve`)Area: Method lookup (typeck, post `rustc_resolve`, not to be confused with `A-resolve`)D-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.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.
I tried this code:
I expected to see this happen: useful message about error from compiler.
Instead, this happened:
As you see, there are only two candidates with "name" for Container2 struct only (from AName2 and from BName2), not four.
There are wrong messages from a compiler about suggesting using not implemented traits "AName" and "BName" with c2. But as you see c2 has only traits AName2 and BName2 implemented. And signature of using "BName2::name" is wrong (2 args are needed, not one).
Meta
rustc --version --verbose: