-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Cannot write integer literal for the minimum i128 (-0x8000_0000_0000_0000_0000_0000_0000_0000i128) #38987
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
Comments
I'd want to give a try on this. |
nagisa
added a commit
to nagisa/rust
that referenced
this issue
Jan 11, 2017
First issue here was the fact that we’d only allow negating integers in i64 range in case the integer was not infered yes. While this is not the direct cause of the issue, its still good to fix it. The real issue here is the code handling specifically the `min_value` literals. While I128_OVERFLOW has the expected value (0x8000_..._0000), match using this value as a pattern is handled incorrectly by the stage1 compiler (it seems to be handled correctly, by the stage2 compiler). So what we do here is extract this pattern into an explicit `==` until the next snapshot. Fixes rust-lang#38987
bors
added a commit
that referenced
this issue
Jan 14, 2017
Fix two const-eval issues related to i128 negation First issue here was the fact that we’d only allow negating integers in i64 range in case the integer was not infered yes. While this is not the direct cause of the issue, its still good to fix it. The real issue here is the code handling specifically the `min_value` literals. While I128_OVERFLOW has the expected value (0x8000_..._0000), match using this value as a pattern is handled incorrectly by the stage1 compiler (it seems to be handled correctly, by the stage2 compiler). So what we do here is extract this pattern into an explicit `==` until the next snapshot. Fixes #38987
kennytm
added a commit
to kennytm/extprim
that referenced
this issue
Feb 8, 2017
Restore the IMIN test as rust-lang/rust#38987 is fixed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Test case:
Gives error:
It should compiles fine and the constant should produce the same value as
i128::MIN
.For comparison the minimum i64 compiles fine with no warnings.
The text was updated successfully, but these errors were encountered: