Let's suppose that we have concrete type defined in one crate Lib1Foo
and generic type defined in another:
pub struct Lib2Boo<T> {
x: T,
}
and in the third crate I want to write something like this:
struct MyType;
impl From<Lib1Foo> for Lib2Boo<MyType> {
fn from(_: Lib1Foo) -> Self {
unimplemented!();
}
}
Why this is violation of
the impl does not reference only types defined in this crate
This error indicates a violation of one of Rust's orphan rules for trait
implementations
?
MyType
defined in the current crate,
so Lib2Boo<MyType>
technically is local crate type,
because of MyType
is defined in current crate, no?