Hello,
When trying to do some type-fu in a much larger project, I stumbled on a conflict detection which shouldn't happen. Here's a minimal version of the issue:
struct A;
struct B;
trait Specializer {
type Key;
}
trait Conflict {
fn conflict(&self);
}
struct C<T>(T);
// A first implementation, note that `A` is a concrete type.
impl<T: Specializer<Key=A>> Conflict for C<T> {
fn conflict(&self) {}
}
// A second implementation, note that `B` is also a concrete type.
// Since `T` can only impl `Specializer` once, no type can impl both `Specializer<Key=B>` and `Specializer<Key=A>`
impl<T: Specializer<Key=B>> Conflict for C<T> {
fn conflict(&self) {}
}
Rust responds with
error[E0119]: conflicting implementations of trait `Conflict` for type `C<_>`
but the implementations don't have any intersection, and shouldn't conflict.
You can also check it out on this playground, where you can see that the conflict is also mis-detected on nightly.
Hello,
When trying to do some type-fu in a much larger project, I stumbled on a conflict detection which shouldn't happen. Here's a minimal version of the issue:
Rust responds with
but the implementations don't have any intersection, and shouldn't conflict.
You can also check it out on this playground, where you can see that the conflict is also mis-detected on nightly.