rust/compiler/rustc_lint/src
许杰友 Jieyou Xu (Joe) 743f26de64
Rollup merge of #136424 - 11happy:overflow.hex.fix, r=fmease
fix: overflowing bin hex

**Overview:**
- This PR fixes #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;
  |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
2025-02-28 21:41:58 +08:00
..
early Reword message 2025-02-20 17:55:31 +00:00
nonstandard_style
types fix: fix overflowing hex wrong suggestion 2025-02-28 07:25:52 +05:30
async_closures.rs Move some Map methods onto TyCtxt. 2025-02-17 13:21:02 +11:00
async_fn_in_trait.rs nightly feature tracking: get rid of the per-feature bool fields 2024-10-23 09:14:41 +01:00
builtin.rs Change span field accesses to method calls 2025-02-24 14:22:31 +01:00
context.rs Greatly simplify lifetime captures in edition 2024 2025-02-22 22:24:52 +00:00
dangling.rs Use identifiers in diagnostics more often 2025-01-27 01:23:34 +00:00
default_could_be_derived.rs Move some Map methods onto TyCtxt. 2025-02-17 13:21:02 +11:00
deref_into_dyn_supertrait.rs update version placeholders 2025-02-18 08:50:21 -08:00
drop_forget_useless.rs Move methods from Map to TyCtxt, part 3. 2025-02-21 14:31:09 +11:00
early.rs fix empty after lint on impl/trait items 2025-02-07 16:47:26 +01:00
enum_intrinsics_non_enums.rs Rustfmt 2025-02-08 22:12:13 +00:00
errors.rs Add warn(unreachable_pub) to rustc_lint. 2024-08-27 15:24:11 +10:00
expect.rs Introduce new-style attribute parsers for several attributes 2025-02-24 14:31:17 +01:00
for_loops_over_fallibles.rs Move methods from Map to TyCtxt, part 2. 2025-02-18 10:17:44 +11:00
foreign_modules.rs Change span field accesses to method calls 2025-02-24 14:22:31 +01:00
hidden_unicode_codepoints.rs Rustfmt 2025-02-08 22:12:13 +00:00
if_let_rescope.rs Print out destructor 2025-02-26 19:03:29 +00:00
impl_trait_overcaptures.rs Rollup merge of #136787 - compiler-errors:lt2024feat, r=oli-obk 2025-02-22 01:01:40 +01:00
internal.rs Move methods from Map to TyCtxt, part 3. 2025-02-21 14:31:09 +11:00
invalid_from_utf8.rs invalid_from_utf8[_unchecked]: also lint inherent methods 2025-02-16 16:34:51 +03:00
late.rs Move methods from Map to TyCtxt, part 2. 2025-02-18 10:17:44 +11:00
let_underscore.rs Rustfmt 2025-02-08 22:12:13 +00:00
levels.rs Move methods from Map to TyCtxt, part 2. 2025-02-18 10:17:44 +11:00
lib.rs Rollup merge of #137109 - bend-n:knife, r=oli-obk 2025-02-24 18:46:35 -05:00
lints.rs Reword message 2025-02-20 17:55:31 +00:00
macro_expr_fragment_specifier_2024_migration.rs Rename RefTokenTreeCursor. 2024-12-18 10:39:07 +11:00
map_unit_fn.rs Rustfmt 2025-02-08 22:12:13 +00:00
multiple_supertrait_upcastable.rs Compiler: Finalize dyn compatibility renaming 2025-01-26 21:20:31 +01:00
non_ascii_idents.rs Fix binding mode problems 2025-02-22 00:13:19 +00:00
non_fmt_panic.rs Rustfmt 2025-02-08 22:12:13 +00:00
non_local_def.rs Rustfmt 2025-02-08 22:12:13 +00:00
nonstandard_style.rs Introduce new-style attribute parsers for several attributes 2025-02-24 14:31:17 +01:00
noop_method_call.rs Rustfmt 2025-02-08 22:12:13 +00:00
opaque_hidden_inferred_bound.rs Rustfmt 2025-02-08 22:12:13 +00:00
pass_by_value.rs Rustfmt 2025-02-08 22:12:13 +00:00
passes.rs fix empty after lint on impl/trait items 2025-02-07 16:47:26 +01:00
precedence.rs Temporarily switch ambiguous_negative_literals lint to allow 2024-07-31 19:36:47 +02:00
ptr_nulls.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
redundant_semicolon.rs Rustfmt 2025-02-08 22:12:13 +00:00
reference_casting.rs move fn is_item_raw to TypingEnv 2024-11-19 18:06:20 +01:00
shadowed_into_iter.rs Move methods from Map to TyCtxt, part 3. 2025-02-21 14:31:09 +11:00
static_mut_refs.rs Rustfmt 2025-02-08 22:12:13 +00:00
tests.rs update cfg(bootstrap) 2025-01-08 21:26:39 +01:00
traits.rs Rustfmt 2025-02-08 22:12:13 +00:00
types.rs Rollup merge of #137448 - compiler-errors:control-flow-oops, r=scottmcm 2025-02-23 02:44:20 -05:00
unit_bindings.rs Rustfmt 2025-02-08 22:12:13 +00:00
unqualified_local_imports.rs Move methods from Map to TyCtxt, part 3. 2025-02-21 14:31:09 +11:00
unused.rs Remove unnecessary check code in unused_delims 2025-02-15 07:35:28 +08:00