- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Open
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.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
Not sure if this needs to be an error or not.
Per rustc --explain E0207, impl type parameter are acceptable if they appear in the Self type of the impl. Emphasis mine:
Any type parameter or lifetime parameter of an
implmust meet at least one of
the following criteria:
- it appears in the implementing type of the impl, e.g.
impl<T> Foo<T>- for a trait impl, it appears in the implemented trait, e.g.
impl<T> SomeTrait<T> for Foo- it is bound as an associated type, e.g.
impl<T, U> SomeTrait for T where T: AnotherTrait<AssocType=U>
Rustc currently generates an error even if an associated type of the parameter appears in the Self type: playground link:
trait Field {}
trait Vector {
    type MyField: Field;
}
struct BaseFieldPrinter<F: Field>;
impl<V: Vector> BaseFieldPrinter<V::MyField> {
}It seems like this doesn't need to be an error, but perhaps I'm missing something?
Metadata
Metadata
Assignees
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.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.