Closed
Description
This may be a duplicate of #19058, but the code looks somewhat different - there is only one associated type. Here, the idea is to blanket impl a trait with an associated type based on another.
#![feature(associated_types)]
trait Base {}
trait AssocA {
type X: Base;
}
trait AssocB {
type Y: Base;
}
impl<T: AssocA> AssocB for T {
type Y = <T as AssocA>::X;
}
fn main() {}
produces
asty.rs:9:1: 11:2 error: the trait `Base` is not implemented for the type `X`
asty.rs:9 impl<T: AssocA> AssocB for T {
asty.rs:10 type Y = <T as AssocA>::X;
asty.rs:11 }
asty.rs:9:1: 11:2 note: the trait `Base` must be implemented because it is required by `AssocB`
asty.rs:9 impl<T: AssocA> AssocB for T {
asty.rs:10 type Y = <T as AssocA>::X;
asty.rs:11 }
which is clearly wrong, since AssocA::X is required to implement Base.