Closed
Description
Let's start off with an example:
#[derive(PartialEq)]
struct Foo;
fn main() {
let x = &Foo;
assert!(x == Foo);
}
yields
error[E0277]: the trait bound `&Foo: std::cmp::PartialEq<Foo>` is not satisfied
--> <anon>:6:13
|
6 | assert!(x == Foo);
| ^^^^^^^^
|
= help: the following implementations were found:
= help: <Foo as std::cmp::PartialEq>
Which is either fixed by adding an ampersand before the second argument or a deref before the first
The error message should suggest to insert one or multiple derefs before the argument that has more references than the other. This is a regular issue I get from Rust newcomers.