Compiling playground v0.0.1 (/playground)
error[E0119]: conflicting implementations of trait `From<Value<_>>` for type `Value<_>`
--> src/lib.rs:22:1
|
22 | impl<ORIGIN1: Origin, ORIGIN2: Origin> From<Value<ORIGIN1>> for Value<ORIGIN2> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: conflicting implementation in crate `core`:
- impl<T> From<T> for T;
For more information about this error, try `rustc --explain E0119`.
error: could not compile `playground` due to previous error
I have already found this issue but is there any clear way forward that may allow the case where ORIGIN1 != ORIGIN2?
There are no negative trait bounds or type inequalities in the (stable) language. You could invent your own trait instead of using From, or just write an inherent method instead.
I'm not sure what you mean by that. The compiler can't just assume they are not the same, because nothing in the impl implies that, if this is what you were thinking.
I think this is sound, although I am not much familiar with Rust soundness rules. Is there any plan to implement such functionality in some form or other?
I'm not sure if there is something like that planned; you can search on IRLO or on the Rust-lang RFCs GitHub repository for candidate proposals, if any.