Closed
Description
Our current trait matching rules for operator overloading are somewhat ad-hoc. I've got a branch which implements a more straightforward set of rules, which I think is what we want for 1.0 going forward. Part of completing this bug will be updating the docs.
The rules I've in mind can be summarized as:
Given an expression l op r
where op
is a binary operator and l : L
and r : R
:
- We search for a trait
impl Op<R,T> for L
. Note that there is no attempt to autoderefl
and so forth. - At runtime we'll pass in
&l
and&r
to the trait method (as is reflected in the&self
type etc). - The type of
l op r
isT
.
Metadata
Metadata
Assignees
Labels
No labels