diff options
Diffstat (limited to 'compiler/rustc_error_codes/src/error_codes/E0666.md')
-rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0666.md | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0666.md b/compiler/rustc_error_codes/src/error_codes/E0666.md new file mode 100644 index 000000000..1a0dc5a52 --- /dev/null +++ b/compiler/rustc_error_codes/src/error_codes/E0666.md @@ -0,0 +1,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! +) {} +``` |