]> git.lizzy.rs Git - rust.git/blob - src/librustc_error_codes/error_codes/E0666.md
Rollup merge of #62514 - stephaneyfx:box-ffi, r=nikomatsakis
[rust.git] / src / librustc_error_codes / error_codes / E0666.md
1 `impl Trait` types cannot appear nested in the
2 generic arguments of other `impl Trait` types.
3
4 Example of erroneous code:
5
6 ```compile_fail,E0666
7 trait MyGenericTrait<T> {}
8 trait MyInnerTrait {}
9
10 fn foo(bar: impl MyGenericTrait<impl MyInnerTrait>) {}
11 ```
12
13 Type parameters for `impl Trait` types must be
14 explicitly defined as named generic parameters:
15
16 ```
17 trait MyGenericTrait<T> {}
18 trait MyInnerTrait {}
19
20 fn foo<T: MyInnerTrait>(bar: impl MyGenericTrait<T>) {}
21 ```