-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document behavior of bitwise operators with boolean arguments #26349
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
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). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we used to have arithmetic here, but iirc, @pnkfelix suggested that we remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was incorrectly documented as logical (here's the fix: f2e0810) but it is in fact arithmetic (#23421 (comment))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah ha! Thanks :)
r=me after the 'arithmetic' question is solved |
@bors: r+ rollup |
📌 Commit a8f666f has been approved by |
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.
I'm surprised that bitwise operators
&
,|
and^
are implemented forbool
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.