-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
ops::Range::end out of range (overflowing_literals) #47213
Comments
Okay, after thinking about this issue and talking with somebody this is very, very difficult to solve. |
The solution is to use 0 ..= 255 to denote a closed interval. That syntax was invented to solve the problem you note. |
This is the entire reason that inclusive ranges were added. |
Actually -- perhaps keep this open as a diagnostics issue? Is it possible for |
I'd like to try working on this issue. |
How does this look for a possible message?
|
That message seems nice. |
Closed or inclusive range? The feature was named inclusive, that's why I'm asking. |
You're right, that should say "inclusive." I should also handle |
@porglezomp Any progress? Did you open a PR? |
I haven't made much progress unfortunately, I got distracted by other things and don't know enough about the compiler internals to work very fast. If someone else wants to pick it up that's fine by me; if not, I'll get it done eventually. |
…, r=estebank Suggest using an inclusive range instead of an exclusive range when the endpoint overflows by 1 Fixes rust-lang#47213.
…, r=estebank Suggest using an inclusive range instead of an exclusive range when the endpoint overflows by 1 Fixes rust-lang#47213.
…, r=estebank Suggest using an inclusive range instead of an exclusive range when the endpoint overflows by 1 Fixes rust-lang#47213.
I would expect that the the following prints would lead to the same result, instead rust complains about 256 being out of range for u8, which is correct, but because end is exclusive, it should't complain.
PlayGround
The text was updated successfully, but these errors were encountered: