An example: Rust Playground
trait FieldLens
has the requirement that an implementor is also Lens
, and, importantly: where Self::Target: PartialEq
.
However, as you can see the compiler is not quite satisfied when we try to make a function that takes a L: FieldLens
:
can't compare `<L as Lens>::Target` with `<L as Lens>::Target`
Even though we have asserted previously that any FieldLens
must have Self::Target: PartialEq
, the compiler seems to have forgotten this and we have to tell it again with a where
clause.
Why? What is otherwise the point with associated types bounds?