Closed
Description
The trait system seems to be missing a normalization in bounds for associated items:
trait Parent {
type Ty;
type Assoc: Child<Self::Ty>;
}
trait Child<T> {}
struct ChildWrapper<T>(T);
impl<A, T> Child<A> for ChildWrapper<T> where T: Child<A> {}
struct ParentWrapper<T>(T);
impl<A, T: Parent<Ty = A>> Parent for ParentWrapper<T>
{
type Ty = A;
type Assoc = ChildWrapper<T::Assoc>;
}
produces the error:
error[E0277]: the trait bound `<T as Parent>::Assoc: Child<A>` is not satisfied
--> wrapper.rs:12:1
|
12 | impl<A, T: Parent<Ty = A>> Parent for ParentWrapper<T>
| ^ the trait `Child<A>` is not implemented for `<T as Parent>::Assoc`
|
= help: consider adding a `where <T as Parent>::Assoc: Child<A>` bound
= note: required by `Parent`
error[E0277]: the trait bound `<T as Parent>::Assoc: Child<A>` is not satisfied
--> wrapper.rs:15:5
|
15 | type Assoc = ChildWrapper<T::Assoc>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Child<A>` is not implemented for `<T as Parent>::Assoc`
|
= help: consider adding a `where <T as Parent>::Assoc: Child<A>` bound
= note: required by `Parent`
Metadata
Metadata
Assignees
Labels
Area: Associated items (types, constants & functions)Area: Lazy normalization (tracking issue: #60471)Area: Trait systemCategory: This is a bug.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.Relevant to the compiler team, which will review and decide on the PR/issue.