How do I disambiguate associated types?
问题 My current code looks like this: pub trait A {} pub trait HasA { type A: A; fn gimme_a() -> Self::A; } pub trait RichA: A {} pub trait RichHasA: HasA { type A: RichA; fn gimme_a() -> Self::A; // ... more things go here ... } pub fn main() {} My goal is to be able to use RichHasA as a HasA . The above code fails to compile with: error[E0221]: ambiguous associated type `A` in bounds of `Self` --> src/main.rs:10:21 | 3 | type A: A; | ---------- ambiguous `A` from `HasA` ... 9 | type A: RichA; |