error[E0119]: conflicting implementations of trait `std::convert::From<Bar<_>>` for type `Bar<_>`
--> src/lib.rs:7:1
|
7 | impl<T, F> From<F> for Bar<T> where F: Foo<T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: conflicting implementation in crate `core`:
- impl<T> From<T> for T;
= note: downstream crates may implement trait `Foo<_>` for type `Bar<_>`
Given the orphan rule, how could another crate (downstream crate ??) implement Foo for type Bar ?
I missed something. Could someone enlighten me ?
A trait implementation is considered incoherent if either the orphan rules check fails or there are overlapping implementation instances.
Two trait implementations overlap when there is a non-empty intersection of the traits the implementation is for, the implementations can be instantiated with the same type.
At least one of the types T0..=Tn must be a local type. Let Ti be the first such type.
No uncovered type parameters P1..=Pn may appear in T0..Ti (excluding Ti )
Only the appearance of uncovered type parameters is restricted. Note that for the purposes of coherence, fundamental types are special. The T in Box<T> is not considered covered, and Box<LocalType> is considered local.
For an impl<T> Foo<Baz> for Bar<T>, Foo is not a local trait, but
One of the types Bar<T>, Baz is local (namely, Baz is local)
and the type parameter T is covered in Bar<T>.
(If you don’t want to think about covered/uncovered type parameters, you can also just consider e.g. impl<T> Foo<Baz> for Bar<Baz>.)