-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.D-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.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.
Description
rust/src/test/ui/associated-types/associated-types-eq-1.rs
Lines 4 to 11 in 1fb612b
| pub trait Foo { | |
| type A; | |
| fn boo(&self) -> <Self as Foo>::A; | |
| } | |
| fn foo2<I: Foo>(x: I) { | |
| let _: A = x.boo(); //~ ERROR cannot find type `A` in this scope | |
| } |
we currently show
| error[E0412]: cannot find type `A` in this scope | |
| --> $DIR/associated-types-eq-1.rs:10:12 | |
| | | |
| LL | fn foo2<I: Foo>(x: I) { | |
| | - similarly named type parameter `I` defined here | |
| LL | let _: A = x.boo(); | |
| | ^ help: a type parameter with a similar name exists: `I` |
But the typo checks should also look at the associated types of all the locally accessible types and provide a reasonable suggestion.
In this specific case of assignment, we could also look at the type of boo for an appropriate type to supply.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.D-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.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.