diff options
| author | Marijn Haverbeke <marijnh@gmail.com> | 2012-01-26 12:26:14 +0100 |
|---|---|---|
| committer | Marijn Haverbeke <marijnh@gmail.com> | 2012-01-26 14:25:06 +0100 |
| commit | 87b064b249657c8e65079d01beb77409f69d49cd (patch) | |
| tree | cecb525f7ddf7312521d1a65e93ea8531f23426e /src/test/compile-fail/minus-string.rs | |
| parent | 1792d9ec96d680cb3ec257bfef84baffea352d80 (diff) | |
| download | rust-87b064b249657c8e65079d01beb77409f69d49cd.tar.gz rust-87b064b249657c8e65079d01beb77409f69d49cd.zip | |
First stab at operator overloading
When no built-in interpretation is found for one of the operators
mentioned below, the typechecker will try to turn it into a method
call with the name written next to it. For binary operators, the
method will be called on the LHS with the RHS as only parameter.
Binary:
+ op_add
- op_sub
* op_mul
/ op_div
% op_rem
& op_and
| op_or
^ op_xor
<< op_shift_left
>> op_shift_right
>>> op_ashift_right
Unary:
- op_neg
! op_not
Overloading of the indexing ([]) operator isn't finished yet.
Issue #1520
Diffstat (limited to 'src/test/compile-fail/minus-string.rs')
| -rw-r--r-- | src/test/compile-fail/minus-string.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/test/compile-fail/minus-string.rs b/src/test/compile-fail/minus-string.rs index f77756942b1..776d82bf492 100644 --- a/src/test/compile-fail/minus-string.rs +++ b/src/test/compile-fail/minus-string.rs @@ -1,3 +1,3 @@ -// error-pattern:applying unary minus to non-numeric type `str` +// error-pattern:can not apply unary operator `-` to type `str` fn main() { -"foo"; } |
