Clean up E0128 explanation

This commit is contained in:
Guillaume Gomez 2019-12-22 20:39:25 +01:00
parent 4ee18c94d4
commit 1474d2a41a

View File

@ -1,4 +1,5 @@
Type parameter defaults can only use parameters that occur before them.
A type parameter with default value is using forward declared identifier.
Erroneous code example:
```compile_fail,E0128
@ -7,11 +8,11 @@ struct Foo<T = U, U = ()> {
field2: U,
}
// error: type parameters with a default cannot use forward declared
// identifiers
// identifiers
```
Since type parameters are evaluated in-order, you may be able to fix this issue
by doing:
Type parameter defaults can only use parameters that occur before them. Since
type parameters are evaluated in-order, this issue could be fixed by doing:
```
struct Foo<U = (), T = U> {