1
Fork 0

Rollup merge of #114784 - Urgau:many-improve-invalid_reference_casting-lint, r=est31

Improve `invalid_reference_casting` lint

This PR improves the `invalid_reference_casting` lint:
 - by considering an unlimited number of casts instead only const to mut ptr
 - by also considering ptr-to-integer and integer-to-ptr casts
 - by also taking into account [`ptr::cast`](https://doc.rust-lang.org/std/primitive.pointer.html#method.cast), [`ptr::cast`](https://doc.rust-lang.org/std/primitive.pointer.html#method.cast-1) and [`ptr::cast_const`](https://doc.rust-lang.org/std/primitive.pointer.html#method.cast_const)

Most of this improvements comes from skimming Github Code Search result for [`&mut \*.*as \*const`](https://github.com/search?q=lang%3Arust+%2F%26mut+%5C*.*as+%5C*const%2F&type=code)

r? ``@est31`` (maybe)
This commit is contained in:
Matthias Krüger 2023-08-16 20:10:37 +02:00 committed by GitHub
commit 2667d853a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 137 additions and 35 deletions

View file

@ -543,6 +543,7 @@ symbols! {
const_panic_fmt,
const_param_ty,
const_precise_live_drops,
const_ptr_cast,
const_raw_ptr_deref,
const_raw_ptr_to_usize_cast,
const_refs_to_cell,
@ -1160,6 +1161,7 @@ symbols! {
profiler_runtime,
ptr,
ptr_cast,
ptr_cast_const,
ptr_cast_mut,
ptr_const_is_null,
ptr_from_mut,