Curiously recurring generic trait pattern: overflow evaluating the requirement
问题 I am trying to implement a generic structure with a bunch of fields, where each of the field types should know about the exact type of the whole structure. It's a sort of strategy pattern. pub struct Example<S: Strategy<Example<S, D>>, D> { pub s: S, pub a: S::Associated, pub data: D, } pub trait Strategy<T> { type Associated; fn run(&self, &T); } pub trait HasData { type Data; fn data(&self) -> &Self::Data; } impl<S: Strategy<Self>, D> Example<S, D> { // ^^^^ // the complex code in this impl