mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 11:48:30 +00:00
![]() 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; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` |
||
---|---|---|
.. | ||
early | ||
nonstandard_style | ||
types | ||
async_closures.rs | ||
async_fn_in_trait.rs | ||
builtin.rs | ||
context.rs | ||
dangling.rs | ||
default_could_be_derived.rs | ||
deref_into_dyn_supertrait.rs | ||
drop_forget_useless.rs | ||
early.rs | ||
enum_intrinsics_non_enums.rs | ||
errors.rs | ||
expect.rs | ||
for_loops_over_fallibles.rs | ||
foreign_modules.rs | ||
hidden_unicode_codepoints.rs | ||
if_let_rescope.rs | ||
impl_trait_overcaptures.rs | ||
internal.rs | ||
invalid_from_utf8.rs | ||
late.rs | ||
let_underscore.rs | ||
levels.rs | ||
lib.rs | ||
lints.rs | ||
macro_expr_fragment_specifier_2024_migration.rs | ||
map_unit_fn.rs | ||
multiple_supertrait_upcastable.rs | ||
non_ascii_idents.rs | ||
non_fmt_panic.rs | ||
non_local_def.rs | ||
nonstandard_style.rs | ||
noop_method_call.rs | ||
opaque_hidden_inferred_bound.rs | ||
pass_by_value.rs | ||
passes.rs | ||
precedence.rs | ||
ptr_nulls.rs | ||
redundant_semicolon.rs | ||
reference_casting.rs | ||
shadowed_into_iter.rs | ||
static_mut_refs.rs | ||
tests.rs | ||
traits.rs | ||
types.rs | ||
unit_bindings.rs | ||
unqualified_local_imports.rs | ||
unused.rs |