-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Wrong type suggested in overflowing_bin_hex
#135404
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
Hello @s-cerevisiae I am new to the rust community & interested in contributing, I found this issue interesting & would love to work on it. Can I give it a try ? |
Thank you, @s-cerevisiae! I'm excited to work on this issue. @rustbot claim |
Hello @s-cerevisiae I raised a PR with required changes. Can you please take a look ? |
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Feb 28, 2025
Rollup merge of rust-lang#136424 - 11happy:overflow.hex.fix, r=fmease fix: overflowing bin hex **Overview:** - This PR fixes rust-lang#135404. **Testing** - Tested the updated functionality. - previously emitted diagnostics: ```bash error: literal out of range for `i32` --> src/main.rs:2:9 | 2 | _ = 0x8FFF_FFFF_FFFF_FFFE; | ^^^^^^^^^^^^^^^^^^^^^ | = note: the literal `0x8FFF_FFFF_FFFF_FFFE` (decimal `10376293541461622782`) does not fit into the type `i32` and will become `-2i32` = help: consider using the type `i128` instead = note: `#[deny(overflowing_literals)]` on by default help: to use as a negative number (decimal `-2`), consider using the type `u32` for the literal and cast it to `i32` | 2 | _ = 0x8FFF_FFFF_FFFF_FFFEu32 as i32; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` - current diagnostics: ```bash error: literal out of range for `i32` --> ../temp.rs:2:13 | 2 | let x = 0x8FFF_FFFF_FFFF_FFFE; | ^^^^^^^^^^^^^^^^^^^^^ | = note: the literal `0x8FFF_FFFF_FFFF_FFFE` (decimal `10376293541461622782`) does not fit into the type `i32` and will become `-2i32` = help: consider using the type `u64` instead = note: `#[deny(overflowing_literals)]` on by default help: to use as a negative number (decimal `-2`), consider using the type `u64` for the literal and cast it to `i32` | 2 | let x = 0x8FFF_FFFF_FFFF_FFFEu64 as i32; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
Current output
Desired output
Rationale and extra context
Found this when working on #135249. Wrong type is suggested in overflowing bin/hex literals for them to be casted back to current type.
Other cases
Rust Version
Anything else?
No response
The text was updated successfully, but these errors were encountered: