Do not suggest try_into
when we can statically verify it would panic
#60384
Labels
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
#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.The text was updated successfully, but these errors were encountered: