For associated types we include both bounds written on the type
(type X: Trait
) and predicates from the trait: where Self::X: Trait
.
This exists as an optimization to compute only the supertraits of this impl’s
trait that are outlives bounds.
This exists as an optimization to compute only the item bounds of the item
that are not Self
bounds.
Opaque types don’t inherit bounds from their parent: for return position
impl trait it isn’t possible to write a suitable predicate on the
containing function and for type-alias impl trait we don’t have a backwards
compatibility issue.
The code below is quite involved, so let me explain.