Skip to content

Commit 8bedc0b

Browse files
committed
---
yaml --- r: 34663 b: refs/heads/master c: eff4a36 h: refs/heads/master i: 34661: 26a2a63 34659: c371f13 34655: 57e2c10 v: v3
1 parent 290a094 commit 8bedc0b

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: edf493f07b5316363a3ced23572c7ed79310b048
2+
refs/heads/master: eff4a36b3e5cfbd2b08bb5a3e8d07396dc532033
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: eb8fd119c65c67f3b1b8268cc7341c22d39b7b61
55
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024

trunk/doc/rust.md

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1674,40 +1674,49 @@ Binary operators expressions are given in terms of
16741674

16751675
#### Arithmetic operators
16761676

1677-
Binary arithmetic expressions require both their operands to be of the
1678-
same type, and can be applied only to numeric types, with the
1679-
exception of `+`, which acts both as addition operator on numbers and
1680-
as concatenate operator on vectors and strings.
1677+
Binary arithmetic expressions are syntactic sugar for calls to built-in traits,
1678+
defined in the `core::ops` module of the `core` library.
1679+
This means that arithmetic operators can be overridden for user-defined types.
1680+
The default meaning of the operators on standard types is given here.
16811681

16821682
`+`
16831683
: Addition and vector/string concatenation.
1684+
Calls the `add` method on the `core::ops::Add` trait.
16841685
`-`
16851686
: Subtraction.
1687+
Calls the `sub` method on the `core::ops::Sub` trait.
16861688
`*`
16871689
: Multiplication.
1690+
Calls the `mul` method on the `core::ops::Mul` trait.
16881691
`/`
16891692
: Division.
1693+
Calls the `div` method on the `core::ops::Div` trait.
16901694
`%`
1691-
: Remainder.
1695+
: Modulo (a.k.a. "remainder").
1696+
Calls the `modulo` method on the `core::ops::Modulo` trait.
16921697

16931698
#### Bitwise operators
16941699

1695-
Bitwise operators apply only to integer types, and perform their
1696-
operation on the bits of the two's complement representation of the
1697-
values.
1700+
Bitwise operators apply are, like the [arithmetic operators](#arithmetic-operators),
1701+
syntactic sugar for calls to built-in traits.
1702+
This means that bitwise operators can be overridden for user-defined types.
1703+
The default meaning of the operators on standard types is given here.
16981704

16991705
`&`
17001706
: And.
1707+
Calls the `bitand` method on the `core::ops::BitAnd` trait.
17011708
`|`
17021709
: Inclusive or.
1710+
Calls the `bitor` method on the `core::ops::BitOr` trait.
17031711
`^`
17041712
: Exclusive or.
1713+
Calls the `bitxor` method on the `core::ops::BitXor` trait.
17051714
`<<`
17061715
: Logical left shift.
1716+
Calls the `shl` method on the `core::ops::Shl` trait.
17071717
`>>`
17081718
: Logical right shift.
1709-
`>>>`
1710-
: Arithmetic right shift.
1719+
Calls the `shr` method on the `core::ops::Shr` trait.
17111720

17121721
#### Lazy boolean operators
17131722

0 commit comments

Comments
 (0)