Handle negative literals in cast overflow warning #48535
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-lint
Area: Lints (warnings about flaws in source code) such as unused_mut.
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
D-papercut
Diagnostics: An error or lint that needs small tweaks.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
#48432 introduced a warning note explaining why a given literal falls outside of the size of the expected type.
In the case of negative literals, the output can be confusing:
fail
will end up with the value1
, as the binary literal evaluates to-1
, but it is negated again. The warning should be extended to catch this case and either modify the existing note/label, or add an extra note explaining that the value is being affected further by the outer-
, resulting in the final value1
.The text was updated successfully, but these errors were encountered: