mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 06:51:58 +00:00
21 lines
399 B
Rust
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));
|
|
}
|