Skip to content

Add a warning for casts with loss of precision #17900

Closed
@bfops

Description

@bfops

e.g. this code should probably generate a warning:

fn main() {
    let i: u16 = 257;
    println!("{}", i as u8);
}

(Sorry if this has been mentioned elsewhere - I didn't see it when searching for "cast warning")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions