Skip to content

Commit c01c1fd

Browse files
Add E0220 error explanation
1 parent d165867 commit c01c1fd

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

src/librustc_typeck/diagnostics.rs

+28-3
Original file line numberDiff line numberDiff line change
@@ -1551,7 +1551,8 @@ impl Foo for Bar {
15511551
"##,
15521552

15531553
E0191: r##"
1554-
You have to specify all the associated types. Erroneous code example:
1554+
Trait objects need to have all associated types specified. Erroneous code
1555+
example:
15551556
15561557
```
15571558
trait Trait {
@@ -1563,7 +1564,7 @@ type Foo = Trait; // error: the value of the associated type `Bar` (from
15631564
```
15641565
15651566
Please verify you specified all associated types of the trait or that you
1566-
used the good trait. Example:
1567+
used the right trait. Example:
15671568
15681569
```
15691570
trait Trait {
@@ -1855,6 +1856,31 @@ extern "rust-intrinsic" {
18551856
```
18561857
"##,
18571858

1859+
E0220: r##"
1860+
You used an associated type which isn't defined in the trait.
1861+
Erroneous code example:
1862+
1863+
```
1864+
trait Trait {
1865+
type Bar;
1866+
}
1867+
1868+
type Foo = Trait<F=i32>; // error: associated type `F` not found for
1869+
// `Trait`
1870+
```
1871+
1872+
Please verify you used the good trait or you didn't mispelled the
1873+
associated type name. Example:
1874+
1875+
```
1876+
trait Trait {
1877+
type Bar;
1878+
}
1879+
1880+
type Foo = Trait<Bar=i32>; // ok!
1881+
```
1882+
"##,
1883+
18581884
E0243: r##"
18591885
This error indicates that not enough type parameters were found in a type or
18601886
trait.
@@ -2115,7 +2141,6 @@ register_diagnostics! {
21152141
E0217, // ambiguous associated type, defined in multiple supertraits
21162142
E0218, // no associated type defined
21172143
E0219, // associated type defined in higher-ranked supertrait
2118-
E0220, // associated type not found for type parameter
21192144
E0221, // ambiguous associated type in bounds
21202145
//E0222, // Error code E0045 (variadic function must have C calling
21212146
// convention) duplicate

0 commit comments

Comments
 (0)