@@ -2058,8 +2058,13 @@ E0210: r##"
2058
2058
This error indicates a violation of one of Rust's orphan rules for trait
2059
2059
implementations. The rule concerns the use of type parameters in an
2060
2060
implementation 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.
2063
2068
2064
2069
If `ForeignTrait` is a trait defined in some external crate `foo`, then the
2065
2070
following trait `impl` is an error:
@@ -2117,12 +2122,17 @@ impl<P1, ..., Pm> ForeignTrait<T1, ..., Tn> for T0 { ... }
2117
2122
2118
2123
where `P1, ..., Pm` are the type parameters of the `impl` and `T0, ..., Tn`
2119
2124
are 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).
2123
2126
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].
2125
2134
2135
+ [RFC 2451]: https://rust-lang.github.io/rfcs/2451-re-rebalancing-coherence.html
2126
2136
[RFC 1023]: https://github.com/rust-lang/rfcs/blob/master/text/1023-rebalancing-coherence.md
2127
2137
"## ,
2128
2138
0 commit comments