Skip to content

Commit 49946dd

Browse files
authored
Rollup merge of #60358 - nickolay:patch-1, r=GuillaumeGomez
Clarify the short explanation of E0207 After being greatly improved in #33692, https://doc.rust-lang.org/error-index.html#E0207 uses terminology from the related RFC, which is different from the [reference](https://doc.rust-lang.org/reference/items/implementations.html), e.g. "self type" instead of "implementing type" and "trait reference" instead of "implemented trait". It probably makes no difference to an experienced reader, but for a newbie like me it added to the confusion as you can't look up the definition of the terms being used and can't be sure you've guessed correctly... I would also move the link to RFC to the top, as it seems to be the only doc that attempts to explain what the third criteria entails), but it seems to go against the accepted style.
2 parents c9b7014 + 35f1c2f commit 49946dd

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
@@ -1942,9 +1942,11 @@ E0207: r##"
19421942
Any type parameter or lifetime parameter of an `impl` must meet at least one of
19431943
the following criteria:
19441944
1945-
- it appears in the self type of the impl
1946-
- for a trait impl, it appears in the trait reference
1947-
- it is bound as an associated type
1945+
- it appears in the _implementing type_ of the impl, e.g. `impl<T> Foo<T>`
1946+
- for a trait impl, it appears in the _implemented trait_, e.g.
1947+
`impl<T> SomeTrait<T> for Foo`
1948+
- it is bound as an associated type, e.g. `impl<T, U> SomeTrait for T
1949+
where T: AnotherTrait<AssocType=U>`
19481950
19491951
### Error example 1
19501952
@@ -1963,9 +1965,9 @@ impl<T: Default> Foo {
19631965
}
19641966
```
19651967
1966-
The problem is that the parameter `T` does not appear in the self type (`Foo`)
1967-
of the impl. In this case, we can fix the error by moving the type parameter
1968-
from the `impl` to the method `get`:
1968+
The problem is that the parameter `T` does not appear in the implementing type
1969+
(`Foo`) of the impl. In this case, we can fix the error by moving the type
1970+
parameter from the `impl` to the method `get`:
19691971
19701972
19711973
```

0 commit comments

Comments
 (0)