I have been learning about specialization and const generics by implementing a classic matrix data structure. Here is what my struct declaration looks like :
pub struct Matrix<K: Scalar, const N: usize, const P: usize> {
coeffs: [[K; P]; N],
}
I've hit a wall trying to convert for example from a Matrix<u32,3,3>
into a Matrix<f32,3,3>
with the following From
implementation :
impl<K1: Scalar, K2: Scalar, const N: usize, const P: usize> From<Matrix<K2, N, P>> for Matrix<K1, N, P>
where
K1: From<K2>,
{
fn from(m2: Matrix<K2, N, P>) > Matrix<K1, N, P> {
/* code ommited */
}
}
With the #![feature(min_specialization)]
at the top of my lib.rs, in the latest nightly the compiler tells me the following
error[E0119]: conflicting implementations of trait `std::convert::From<matrix::Matrix<_, {_: usize}, {_: usize}>>` for type `matrix::Matrix<_, {_: usize}, {_: usize}>`:
> data_structures/src/matrix.rs:95:1

95  / impl<K1: Scalar, K2: Scalar, const N: usize, const P: usize> From<Matrix<K2, N, P>>
96   for Matrix<K1, N, P>
97   where
98   K1: From<K2>,
... 
108   }
109   }
 _^

= note: conflicting implementation in crate `core`:
 impl<T> From<T> for T;
Maybe I am misunderstanding min_specialization ?