Closed
Description
I was trying to do something like this:
use std::io;
enum Foo<T> {
Bar(T),
Qux,
}
impl<T: PartialEq> PartialEq for Foo<T> {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(&Foo::Bar(ref a), &Foo::Bar(ref b)) => a == b,
(&Foo::Qux, &Foo::Qux) => true,
(_, _) => false,
}
}
}
impl PartialEq for Foo<io::Error> {
fn eq(&self, other: &Self) -> bool {
unimplemented!()
}
}
And got the following error as a result:
error: conflicting implementations of trait `std::cmp::PartialEq` for type `Foo<std::io::Error>`: [--explain E0119]
--> <anon>:18:1
|>
18 |> impl PartialEq for Foo<io::Error> {
|> ^
note: conflicting implementation is here:
--> <anon>:8:1
|>
8 |> impl<T: PartialEq> PartialEq for Foo<T> {
|> ^
error: aborting due to previous error
In and of itself, there is no straightforward explanation as to why this is happening, since io::Error doesn't implement PartialEq.