Skip to content

Commit 35f1c2f

Browse files
committed
Clarify the short explanation of E0207
- Use the terms from the reference <https://doc.rust-lang.org/reference/items/implementations.html> - Add code snippets to explain the terms
1 parent bdfdbcd commit 35f1c2f

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/librustc_typeck/error_codes.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -1943,9 +1943,11 @@ E0207: r##"
19431943
Any type parameter or lifetime parameter of an `impl` must meet at least one of
19441944
the following criteria:
19451945
1946-
- it appears in the self type of the impl
1947-
- for a trait impl, it appears in the trait reference
1948-
- it is bound as an associated type
1946+
- it appears in the _implementing type_ of the impl, e.g. `impl<T> Foo<T>`
1947+
- for a trait impl, it appears in the _implemented trait_, e.g.
1948+
`impl<T> SomeTrait<T> for Foo`
1949+
- it is bound as an associated type, e.g. `impl<T, U> SomeTrait for T
1950+
where T: AnotherTrait<AssocType=U>`
19491951
19501952
### Error example 1
19511953
@@ -1964,9 +1966,9 @@ impl<T: Default> Foo {
19641966
}
19651967
```
19661968
1967-
The problem is that the parameter `T` does not appear in the self type (`Foo`)
1968-
of the impl. In this case, we can fix the error by moving the type parameter
1969-
from the `impl` to the method `get`:
1969+
The problem is that the parameter `T` does not appear in the implementing type
1970+
(`Foo`) of the impl. In this case, we can fix the error by moving the type
1971+
parameter from the `impl` to the method `get`:
19701972
19711973
19721974
```

0 commit comments

Comments
 (0)