Skip to content
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

improve BitAnd trait documentation #35993

Merged
merged 1 commit into from
Aug 30, 2016

Conversation

matthew-piziak
Copy link
Contributor

This pull request is based on the discussion in PR #35927.

Add a module-level note that && and || are short-circuiting operators and not overloadable.

Add a simple Scalar example that lifts the & operator to a trivial struct tuple.

Make BooleanVector a struct tuple.

Derive PartialEq for BooleanVector instead of implementing it.

Adds a fn main wrapper so that the example can integrate with Rust Playground.

@rust-highfive
Copy link
Collaborator

r? @aturon

(rust_highfive has picked a reviewer for you, use r? to override)

@matthew-piziak
Copy link
Contributor Author

r? @GuillaumeGomez

/// type Output = Self;
///
/// fn bitand(self, Scalar(rhs): Self) -> Self {
/// let Scalar(lhs) = self;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you some comments here (at least to explain a bit about lhs and rhs, I think some people don't know what this is).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How's this?

This pull request is based on the discussion in PR rust-lang#35927.

Add a module-level note that `&&` and `||` are short-circuiting operators and not overloadable.

Add a simple `Scalar` example that lifts the `&` operator to a trivial struct tuple.

Make `BooleanVector` a struct tuple.

Derive `PartialEq` for `BooleanVector` instead of implementing it.

Adds a `fn main` wrapper so that the example can integrate with Rust Playground.

simplified bitand expression

add a comment explaining what "rhs" means
@GuillaumeGomez
Copy link
Member

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented Aug 26, 2016

📌 Commit e2d9974 has been approved by GuillaumeGomez

steveklabnik added a commit to steveklabnik/rust that referenced this pull request Aug 26, 2016
…=GuillaumeGomez

improve `BitAnd` trait documentation

This pull request is based on the discussion in PR rust-lang#35927.

Add a module-level note that `&&` and `||` are short-circuiting operators and not overloadable.

Add a simple `Scalar` example that lifts the `&` operator to a trivial struct tuple.

Make `BooleanVector` a struct tuple.

Derive `PartialEq` for `BooleanVector` instead of implementing it.

Adds a `fn main` wrapper so that the example can integrate with Rust Playground.
@bors
Copy link
Contributor

bors commented Aug 29, 2016

⌛ Testing commit e2d9974 with merge 01a010a...

@bors
Copy link
Contributor

bors commented Aug 29, 2016

💔 Test failed - auto-mac-64-opt-rustbuild

@arielb1
Copy link
Contributor

arielb1 commented Aug 29, 2016

@bors retry

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Aug 29, 2016
…=GuillaumeGomez

improve `BitAnd` trait documentation

This pull request is based on the discussion in PR rust-lang#35927.

Add a module-level note that `&&` and `||` are short-circuiting operators and not overloadable.

Add a simple `Scalar` example that lifts the `&` operator to a trivial struct tuple.

Make `BooleanVector` a struct tuple.

Derive `PartialEq` for `BooleanVector` instead of implementing it.

Adds a `fn main` wrapper so that the example can integrate with Rust Playground.
bors added a commit that referenced this pull request Aug 29, 2016
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Aug 30, 2016
…=GuillaumeGomez

improve `BitAnd` trait documentation

This pull request is based on the discussion in PR rust-lang#35927.

Add a module-level note that `&&` and `||` are short-circuiting operators and not overloadable.

Add a simple `Scalar` example that lifts the `&` operator to a trivial struct tuple.

Make `BooleanVector` a struct tuple.

Derive `PartialEq` for `BooleanVector` instead of implementing it.

Adds a `fn main` wrapper so that the example can integrate with Rust Playground.
bors added a commit that referenced this pull request Aug 30, 2016
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Aug 30, 2016
…=GuillaumeGomez

improve `BitAnd` trait documentation

This pull request is based on the discussion in PR rust-lang#35927.

Add a module-level note that `&&` and `||` are short-circuiting operators and not overloadable.

Add a simple `Scalar` example that lifts the `&` operator to a trivial struct tuple.

Make `BooleanVector` a struct tuple.

Derive `PartialEq` for `BooleanVector` instead of implementing it.

Adds a `fn main` wrapper so that the example can integrate with Rust Playground.
bors added a commit that referenced this pull request Aug 30, 2016
@bors bors merged commit e2d9974 into rust-lang:master Aug 30, 2016
matthew-piziak added a commit to matthew-piziak/rust that referenced this pull request Aug 30, 2016
These are exactly equivalent to PR rust-lang#35809, with one caveat: I do not believe there is a non-bitwise binary "xor" operator in Rust, so here it's expressed as (a || b) && !(a && b).

r? @GuillaumeGomez

improved documentation a la PR rust-lang#35993
matthew-piziak added a commit to matthew-piziak/rust that referenced this pull request Aug 30, 2016
This is the augmented-assignment version of PR rust-lang#35809.

r? @GuillaumeGomez

improved documentation a la PR rust-lang#35993
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants