Skip to content

Commit 9da3a7a

Browse files
Clean up E0666 explanation
1 parent ccac43b commit 9da3a7a

File tree

1 file changed

+11
-7
lines changed
  • src/librustc_error_codes/error_codes

1 file changed

+11
-7
lines changed
+11-7
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
1-
`impl Trait` types cannot appear nested in the
2-
generic arguments of other `impl Trait` types.
1+
`impl Trait` types cannot appear nested in the generic arguments of other
2+
`impl Trait` types.
33

4-
Example of erroneous code:
4+
Erroneous code example:
55

66
```compile_fail,E0666
77
trait MyGenericTrait<T> {}
88
trait MyInnerTrait {}
99
10-
fn foo(bar: impl MyGenericTrait<impl MyInnerTrait>) {}
10+
fn foo(
11+
bar: impl MyGenericTrait<impl MyInnerTrait>, // error!
12+
) {}
1113
```
1214

13-
Type parameters for `impl Trait` types must be
14-
explicitly defined as named generic parameters:
15+
Type parameters for `impl Trait` types must be explicitly defined as named
16+
generic parameters:
1517

1618
```
1719
trait MyGenericTrait<T> {}
1820
trait MyInnerTrait {}
1921
20-
fn foo<T: MyInnerTrait>(bar: impl MyGenericTrait<T>) {}
22+
fn foo<T: MyInnerTrait>(
23+
bar: impl MyGenericTrait<T>, // ok!
24+
) {}
2125
```

0 commit comments

Comments
 (0)