Skip to content

Assignment of hexadecimal and integer types is not interchangeable. #108269

Closed
@TimePrinciple

Description

@TimePrinciple

In code:

println!("{:#X}", i32::MIN);

It will tell me that i32::MIN is 0X80000000, but if I try to assign an i32 with 0X80000000, I would get an error says literal out of range.

I suggest to add methods to support assignment of integer types with exact bits, like I can assign i32 with the exact 32 bits in 0X80000000.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-fmtArea: `core::fmt`A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions