Skip to content

Added support for primitive types type inference with std::ops::Not #698

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

Merged
merged 2 commits into from
Jan 28, 2019

Conversation

WizardOfMenlo
Copy link
Contributor

On the guideline of #544 , this allows for type inference for all primitive types implementing std::ops::Not. I think this should be relevant #394 as well?

@marcusklaas
Copy link
Contributor

TIL you can negate numbers in rust!

@matklad
Copy link
Member

matklad commented Jan 28, 2019

TIL you can negate numbers in rust!

That's an interesting difference with C. C doesn't have bool, so it has two negation operators:

  • ! for boolean negation, which turns 0 into 1 and any other number into 1
  • ~ for bitwise negation

Because Rust does have a boolean type, and, unlike C++, does not have source compatability with C, it can use ! for bitwise negatino of integers.

@flodiebold
Copy link
Member

Thanks!

bors r+

bors bot added a commit that referenced this pull request Jan 28, 2019
698: Added support for primitive types type inference with std::ops::Not r=flodiebold a=WizardOfMenlo

On the guideline of #544 , this allows for type inference for all primitive types implementing [std::ops::Not](https://doc.rust-lang.org/beta/std/ops/trait.Not.html). I think this should be relevant #394 as well?

Co-authored-by: WizardOfMenlo <[email protected]>
@bors
Copy link
Contributor

bors bot commented Jan 28, 2019

Build succeeded

@bors bors bot merged commit ec32b2e into rust-lang:master Jan 28, 2019
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.

4 participants