summaryrefslogtreecommitdiffstats
path: root/tests/ui/binop/issue-93927.rs
blob: de27c9785e65a40f65270fc63cee1a59263a830b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// 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));
}