Is there a way at all to ensure a compile error is thrown?
Let's take the following scenario. Someone is making a special geometry library.
trait Calculable<A> : std::ops::Add {}
struct Length;
struct Angle;
impl Calculable<Length> for Length {}
impl std::ops::Add<Length> for Length {
....
}
impl Calculable<Angle> for Angle {}
impl std::ops::Add<Angle> for Angle {
....
}
This example describes a situation where Length + Length is valid, and Angle + Angle is valid, but Length + Angle is not, because Add<Angle> is not implemented for Length.
One would actually consider it a bug if this were to be allowed, in some way.
So, similar to #[should_panic], is there anything like #[shouldnt_compile]?