rust/compiler/rustc_lint
Matthias Krüger f530016f50
Rollup merge of #111212 - nicklimmm:issue-107896-fix, r=pnkfelix
Add casting suggestion when assigning negative 2's complement bin or hex literal to a size compatible signed integer

Fixes #107896

The issue stated the case for `iX::MIN` variants. This PR extends the cases for other negative values (in the 2's complement).

Leveraged sign bits to detect such cases.

Example cases:
- <img width="845" alt="image" src="https://user-images.githubusercontent.com/65026286/236289682-19859f59-a9c5-48c5-b15f-78a935fbfcec.png">
- <img width="831" alt="image" src="https://user-images.githubusercontent.com/65026286/236289805-5b16488d-9138-4363-a1b6-a5c027c50aba.png">
- <img width="912" alt="image" src="https://user-images.githubusercontent.com/65026286/236290065-685a9777-034b-4def-83a8-cc4e20b1ed0c.png">
2023-06-15 17:52:35 +02:00
..
src Rollup merge of #111212 - nicklimmm:issue-107896-fix, r=pnkfelix 2023-06-15 17:52:35 +02:00
Cargo.toml Add rustc_fluent_macro to decouple fluent from rustc_macros 2023-04-18 18:56:22 +00:00
messages.ftl Add subdiagnostic and suggestion for overflowing bin hex with sign bits 2023-06-11 18:27:26 +08:00