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

Use i64, and allow trivial_numeric_casts #7

Merged
merged 3 commits into from
Jan 23, 2018

Conversation

cuviper
Copy link
Member

@cuviper cuviper commented Jan 23, 2018

The traits are implemented from 64-bit values, and we don't want to lose
any bits when comparing on platforms with smaller isize.

Simple enum expressions may have no explicit type, like A = 1, so then
the derived 1 as i64 is inferred like 1i64 as i64, a trivial numeric
cast. But it's quite possible that other expressions could have explicit
types, so we can't just assign it directly either. The simple solution is
to just allow the trivial_numeric_casts in derived code.

Fixes #6.

The traits are implemented from 64-bit values, and we don't want to
lose any bits when comparing on platforms with smaller `isize`.
Simple enum expressions may have no explicit type, like `A = 1`, so then
the derived `1 as i64` is inferred like `1i64 as i64`, a trivial numeric
cast.  But it's quite possible that other expressions could have
explicit types, so we can't just assign it directly either.  The simple
solution is to just allow the `trivial_numeric_casts` in derived code.
@Pzixel
Copy link
Contributor

Pzixel commented Jan 23, 2018

great job!

@cuviper
Copy link
Member Author

cuviper commented Jan 23, 2018

Thanks for checking it!

bors r+

bors bot added a commit that referenced this pull request Jan 23, 2018
7: Use i64, and allow trivial_numeric_casts r=cuviper a=cuviper

The traits are implemented from 64-bit values, and we don't want to lose
any bits when comparing on platforms with smaller `isize`.

Simple enum expressions may have no explicit type, like `A = 1`, so then
the derived `1 as i64` is inferred like `1i64 as i64`, a trivial numeric
cast.  But it's quite possible that other expressions could have explicit
types, so we can't just assign it directly either.  The simple solution is
to just allow the `trivial_numeric_casts` in derived code.

Fixes #6.
@Pzixel
Copy link
Contributor

Pzixel commented Jan 23, 2018

Wait, I didn't check it yet :) Going to do it now.

Yep, it does! 🎉

@bors
Copy link
Contributor

bors bot commented Jan 23, 2018

Build succeeded

@bors bors bot merged commit c833a9e into rust-num:master Jan 23, 2018
@cuviper
Copy link
Member Author

cuviper commented Jan 23, 2018

Oops. :) I'll wait for you before I publish anything...

@Pzixel
Copy link
Contributor

Pzixel commented Jan 23, 2018

@cuviper see edit :) I actually was going to sleep, but your response has waken me up 😄

P.S. Shouldn't we update version?

@cuviper
Copy link
Member Author

cuviper commented Jan 23, 2018

(quietly) num-traits 0.1.43 is published -- good night!

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.

2 participants