-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Lint casting integers to pointers #2177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
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 interested |
@rustbot claim |
should I create a separate lint since zero_ptr is associated with null ptr, whereas a dangling pointer can take on any value if I'm not wrong? |
They should probably be separate, because the fix for them is different. The zero case can be fixed with |
rust-lang/rust#45527 gives us
std::ptr::dangling
which allows replacing1 as _
withstd::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
The text was updated successfully, but these errors were encountered: