rust-clippy
rust-clippy copied to clipboard
Lint casting integers to pointers
https://github.com/rust-lang/rust/pull/45527 gives us std::ptr::dangling
which allows replacing 1 as _
with std::ptr::dangling()
. Once that is stable, it should be a warn lint. Until then an allow lint is ok.
Should probably live together with the zero_ptr lint
Is anyone still interested in implementing this? Even if there is no fix that Clippy can propose, just giving the user the ability to track down such casts is already useful. Note that such casts create a pointer with no provenance, which can be particularly objectionable for future development of Rust code.