blob: 1a0dc5a522962a06d263754e69df94fd8996aeae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
`impl Trait` types cannot appear nested in the generic arguments of other
`impl Trait` types.
Erroneous code example:
```compile_fail,E0666
trait MyGenericTrait<T> {}
trait MyInnerTrait {}
fn foo(
bar: impl MyGenericTrait<impl MyInnerTrait>, // error!
) {}
```
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>, // ok!
) {}
```
|