Impossible conflict implementations

Rustc complained "error[E0119]: conflicting implementations of trait Trait2<_> for type i32" for the following code.

trait Trait {
    type Associated;
}

trait Trait2<T> {}

impl<T: Trait<Associated = i64>> Trait2<T> for i32 {}
impl<T: Trait<Associated = u64>> Trait2<T> for i32 {}

However it's impossible for a type that both impls Trait<Associated = i64> and Trait<Associated = u64>. Is there a nightly feature to bypass this case?

It's blocked on a design for mutually exclusive traits (which this feature can emulate).

1 Like