Impossible conflict implementations

⚓ Rust    📅 2025-06-27    👤 surdeus    👁️ 6      

surdeus

Warning

This post was published 44 days ago. The information described in this article may have changed.

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?

2 posts - 2 participants

Read full topic

🏷️ rust_feed