impl Trait
types cannot appear nested in the generic arguments of other impl Trait
types.
Example of erroneous code:
trait MyGenericTrait<T> {} trait MyInnerTrait {} fn foo(bar: impl MyGenericTrait<impl MyInnerTrait>) {}
Type parameters for impl Trait
types must be explicitly defined as named generic parameters:
trait MyGenericTrait<T> {} trait MyInnerTrait {} fn foo<T: MyInnerTrait>(bar: impl MyGenericTrait<T>) {}