rust-clippy icon indicating copy to clipboard operation
rust-clippy copied to clipboard

Lint casting integers to pointers

Open oli-obk opened this issue 7 years ago • 1 comments

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

oli-obk avatar Oct 26 '17 08:10 oli-obk

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.

Rua avatar Apr 30 '24 17:04 Rua