What is the point with associated types bounds in a trait definition?

An example: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=085e5bf55002cad7d5dc542402e3c47b

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?

It would work if that constraint was on the original Target declaration in Lens, but in a less direct situation like yours, I think it's this bug:

4 Likes