Closed
Description
Pretty bad title - sorry. Somebody who knows the type checker might be able to do better.
Here is a minimal example:
pub trait Real {}
pub trait VectorSpace {
type Scalar;
}
pub trait InnerSpace: VectorSpace where
<Self as VectorSpace>::Scalar: Real,
{
fn dot(self, other: Self) -> Self::Scalar;
}
pub fn dot<V: InnerSpace>(a: V, b: V) -> V::Scalar {
V::dot(a, b)
}
<anon>:13:1: 15:2 error: the trait `Real` is not implemented for the type `<V as VectorSpace>::Scalar` [E0277]
<anon>:13 pub fn dot<V: InnerSpace>(a: V, b: V) -> V::Scalar {
<anon>:14 V::dot(a, b)
<anon>:15 }
<anon>:13:1: 15:2 help: see the detailed explanation for E0277
<anon>:13:1: 15:2 note: required by `InnerSpace`