False negative for trivial_casts with pointer #117187
Labels
A-lint
Area: Lints (warnings about flaws in source code) such as unused_mut.
A-raw-pointers
Area: raw pointers, MaybeUninit, NonNull
C-bug
Category: This is a bug.
P-medium
Medium priority
regression-from-stable-to-stable
Performance or correctness regression from one stable version to another.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
After #113262, this will no longer fail to compile:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=8ee721b21617d98d18c5256778b57efe
The cast is trivial, but we miss it because we have to conservatively assume that raw pointer casts are not trivial. A possible fix would be to check for trivial raw pointer casts in MIR (but correctly considering lifetimes is still not quite easy there I think).
The text was updated successfully, but these errors were encountered: