-
Notifications
You must be signed in to change notification settings - Fork 13k
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
i8 literals and friends have incorrect ranges #2438
Comments
The test case for i16 is "log(error, 2048i16);", so it isn't too surprising that it prints 2048... |
@msullivan Yes, the point is that |
Ah. So yeah, that is just a straight up bug. I can fix it. The other part is trickier: I think rust only considers positive literals, and when you write a negative number it is parsed as negation applied to a positive number. This means that if we had the proper positive bound on numbers, you wouldn't be able to write things like "-128i8"... Argh. |
I don't think you need to mess with the parser, as long as the bounds check can be moved to after the negation is applied to the literal. |
I'm splitting the i16 part off into Issue #2462. This bug then is just the maximum value problem. |
Some more weirdness, for your perusal: using 128i8 to successfully index an array.
|
Split that last part into #2468 |
@msullivan or @bstrie -- could you clarify which part of this issue is still open? |
@catamorphism It depends on if you consider it a bug that the literal |
The more immediate problem was fixed, closing this in favor of #6958. |
adjust for more backtrace pruning The Miri side of rust-lang#99690. Those messages are much nicer. :) And we also need error-pattern much less.
We don't need name demangling since we store the mangled and pretty name of harnesses in the metadata file. I also updated the comment in the `symbol_name` function.
https://gist.github.com/2783543
The maximum legal value of signed integers of length
x
should be(2^(x-1)) - 1
, but in most cases Rust allows signed literals of value2^(x-1)
, but then interprets those literals as the minimum legal value (see the output in the gist above).The exception is
i16
, which exhibits the same behavior as above, except that, bafflingly,x
is 12 rather than 16.EDIT: wrong equations
The text was updated successfully, but these errors were encountered: