Skip to content

Do not suggest try_into when we can statically verify it would panic #60384

Closed
@estebank

Description

@estebank

#60159 (comment), follow up to #60159.

When encountering cases like let f = [0_usize; -1_isize];, do not suggest (-1isize).try_into().unwrap() as we can verify that this will always panic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions