rust/tests/ui/binop/issue-93927.rs
2023-01-11 09:32:08 +00:00

21 lines
399 B
Rust

// Regression test for #93927: suggested trait bound for T should be Eq, not PartialEq
struct MyType<T>(T);
impl<T> PartialEq for MyType<T>
where
T: Eq,
{
fn eq(&self, other: &Self) -> bool {
true
}
}
fn cond<T: PartialEq>(val: MyType<T>) -> bool {
val == val
//~^ ERROR binary operation `==` cannot be applied to type `MyType<T>`
}
fn main() {
cond(MyType(0));
}