-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Bad suggestion for overflowing hex literal in signed operation #53628
Comments
Hmm, while you are right, I don't like the expression |
My suggestion was to do the wrapping and output the suggestion using the same radix as the original. As another example, for (For the compiler, the hex literal for the minimum |
You can write the following:
|
Triage: this is now an error, not a warning, but the diagnostic has not changed. |
No, the actual problem here is that |
Code:
Diagnostic:
In this case using
u32
is not an option (you could use au32
literal and cast toi32
, but that's not ideal). A better suggestion in this case would be to use-0x8000_0000
instead.This issue is, I think, more relevant to hex (or other non-decimal) representations, as for example
format!("{:#x}", i32::MIN)
would produce0x80000000
, which could lead someone to think that that is a valid warning-freei32
literal.The text was updated successfully, but these errors were encountered: