@@ -2058,8 +2058,13 @@ E0210: r##"
20582058This error indicates a violation of one of Rust's orphan rules for trait
20592059implementations. The rule concerns the use of type parameters in an
20602060implementation of a foreign trait (a trait defined in another crate), and
2061- states that type parameters must be "covered" by a local type. To understand
2062- what this means, it is perhaps easiest to consider a few examples.
2061+ states that type parameters must be "covered" by a local type.
2062+
2063+ When implementing a foreign trait for a foreign type,
2064+ the trait must have one or more type parameters.
2065+ A type local to your crate must appear before any use of any type parameters.
2066+
2067+ To understand what this means, it is perhaps easier to consider a few examples.
20632068
20642069If `ForeignTrait` is a trait defined in some external crate `foo`, then the
20652070following trait `impl` is an error:
@@ -2117,12 +2122,17 @@ impl<P1, ..., Pm> ForeignTrait<T1, ..., Tn> for T0 { ... }
21172122
21182123where `P1, ..., Pm` are the type parameters of the `impl` and `T0, ..., Tn`
21192124are types. One of the types `T0, ..., Tn` must be a local type (this is another
2120- orphan rule, see the explanation for E0117). Let `i` be the smallest integer
2121- such that `Ti` is a local type. Then no type parameter can appear in any of the
2122- `Tj` for `j < i`.
2125+ orphan rule, see the explanation for E0117).
21232126
2124- For information on the design of the orphan rules, see [RFC 1023].
2127+ Both of the folowing must be true:
2128+ 1. At least one of the types T0..=Tn must be a local type.
2129+ Let Ti be the first such type.
2130+ 2. No uncovered type parameters P1..=Pm may appear in T0..Ti (excluding Ti).
2131+
2132+ For information on the design of the orphan rules,
2133+ see [RFC 2451] and [RFC 1023].
21252134
2135+ [RFC 2451]: https://rust-lang.github.io/rfcs/2451-re-rebalancing-coherence.html
21262136[RFC 1023]: https://github.com/rust-lang/rfcs/blob/master/text/1023-rebalancing-coherence.md
21272137"## ,
21282138
0 commit comments