-
Notifications
You must be signed in to change notification settings - Fork 13.4k
rustc can't parse large untyped literals correctly #18744
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Why is being interpreted as -1 bad? It is exactly that. Could you add a code example demonstrating the issue? |
fn main() {
match 1u64 {
0...0xFFFF_FFFF_FFFF_FFFF => { },
_ => { },
}
} |
|
@huonw: Generic literals are supposed to have an inferred type but Rust treats them as |
I guess that means that fn main() {
match 1u64 {
0...0xFFFF_FFFF_FFFF_FF => { },
_ => { },
}
} which compiles correctly on 64 bit will fail to compile on 32 bit or, much worse, truncate the upper bound to something that fits in an int. |
Triage: same error today. |
The following program does not compile:
The following program does compile:
it's very misleading behavior. |
0xFFFF_FFFF_FFFF_FFFF will be interpreted as -1 in certain situations where the correct type is known to be u64.
The text was updated successfully, but these errors were encountered: