about summary refs log tree commit diff
path: root/src/doc/reference.md
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2015-06-18 13:38:10 +0530
committerManish Goregaokar <manishsmail@gmail.com>2015-06-18 13:38:10 +0530
commit3afc385ae1e25b3747980a1d2652a1fd8c282359 (patch)
tree388cce12b390dc3eda6d886ba636fffc1c058af3 /src/doc/reference.md
parentb5f2b098d7747863b1e647e024777e4baa4907a9 (diff)
parenta8f666f1f4980a9bbc5b1c94db7eb401dbe47070 (diff)
downloadrust-3afc385ae1e25b3747980a1d2652a1fd8c282359.tar.gz
rust-3afc385ae1e25b3747980a1d2652a1fd8c282359.zip
Rollup merge of #26349 - petrochenkov:bitwise, r=steveklabnik
I'm surprised that bitwise operators `&`, `|` and `^` are implemented for `bool` arguments, because inspection of boolean's bits is not something that should be encouraged and because `&&` -> `&` is a common typo, but if they are implemented, then their behavior should be documented.
Diffstat (limited to 'src/doc/reference.md')
-rw-r--r--src/doc/reference.md12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/doc/reference.md b/src/doc/reference.md
index 8b7b3b9b15c..a3e13acccae 100644
--- a/src/doc/reference.md
+++ b/src/doc/reference.md
@@ -2779,22 +2779,24 @@ meaning of the operators on standard types is given here.
 Like the [arithmetic operators](#arithmetic-operators), bitwise operators are
 syntactic sugar for calls to methods of built-in traits. This means that
 bitwise operators can be overridden for user-defined types. The default
-meaning of the operators on standard types is given here.
+meaning of the operators on standard types is given here. Bitwise `&`, `|` and
+`^` applied to boolean arguments are equivalent to logical `&&`, `||` and `!=`
+evaluated in non-lazy fashion.
 
 * `&`
-  : And.
+  : Bitwise AND.
     Calls the `bitand` method of the `std::ops::BitAnd` trait.
 * `|`
-  : Inclusive or.
+  : Bitwise inclusive OR.
     Calls the `bitor` method of the `std::ops::BitOr` trait.
 * `^`
-  : Exclusive or.
+  : Bitwise exclusive OR.
     Calls the `bitxor` method of the `std::ops::BitXor` trait.
 * `<<`
   : Left shift.
     Calls the `shl` method of the `std::ops::Shl` trait.
 * `>>`
-  : Right shift.
+  : Right shift (arithmetic).
     Calls the `shr` method of the `std::ops::Shr` trait.
 
 #### Lazy boolean operators