You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There has been a constant stream of confusion relating to the interaction between auto-deref and various overloaded operators, particularly Eq (e.g., #6257). I think we ought to define the binary operator traits using an associated fn, not a method. This would side-step any issues around autoderef, and also helps to make the method resolution clearer.
For example, Eq would be define as follows:
trait Eq {
fn eq(a: &Self, b: &Self);
}
meaning that x==y would be expanded to:
Eq::eq(&x, &y)
The same would apply to other binary operator traits.
The text was updated successfully, but these errors were encountered:
There has been a constant stream of confusion relating to the interaction between auto-deref and various overloaded operators, particularly
Eq
(e.g., #6257). I think we ought to define the binary operator traits using an associated fn, not a method. This would side-step any issues around autoderef, and also helps to make the method resolution clearer.For example,
Eq
would be define as follows:meaning that
x==y
would be expanded to:The same would apply to other binary operator traits.
The text was updated successfully, but these errors were encountered: