about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/llvm_util.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-04-24 20:16:40 +0000
committerbors <bors@rust-lang.org>2022-04-24 20:16:40 +0000
commit388e6b78544de7cf0423ae93074d0d82b70f10a5 (patch)
tree1c6db1cc77b95f88cf4aa4a029be830cca3e0520 /compiler/rustc_codegen_llvm/src/llvm_util.rs
parent6aa3684431e85609eab1168098915afcb4e20d65 (diff)
parentb4a50e9ee5adda55ad68b0dc637433fa0936e10e (diff)
downloadrust-388e6b78544de7cf0423ae93074d0d82b70f10a5.tar.gz
rust-388e6b78544de7cf0423ae93074d0d82b70f10a5.zip
Auto merge of #8742 - goth-turtle:mistyped-literal-suffix, r=llogiq
mistyped_literal_suffix: improve integer suggestions, avoid wrong float suggestions

This PR fixes 2 things:
- The known problem that integer types are always suggested as signed, by suggesting an unsigned suffix for literals that wouldnt fit in the signed type, and ignores any literals too big for the corresponding unsigned type too.
- The lint would only look at the integer part of any floating point literals without an exponent, this causing #6129. This just ignores those literals.

Examples:
```rust
let _ = 2_32; // still 2_i32
let _ = 234_8; // would now suggest 234_u8

// these are now ignored
let _ = 500_8;
let _ = 123_32.123;
```

changelog: suggest correct integer types in [`mistyped_literal_suffix`], ignore float literals without an exponent
fixes #6129
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm_util.rs')
0 files changed, 0 insertions, 0 deletions