about summary refs log tree commit diff
path: root/compiler/rustc_parse/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-08-02 11:25:13 +0000
committerbors <bors@rust-lang.org>2023-08-02 11:25:13 +0000
commitd1708334312f654204edd21b3e93cf29da847187 (patch)
tree02fdb883ebe5af95b545c21ab598e996cdc21c4d /compiler/rustc_parse/src
parent64ad036307727d21070a46f1a5e323cd442229da (diff)
parent507d497cfa014514c5dd904f9d273810e888f757 (diff)
downloadrust-d1708334312f654204edd21b3e93cf29da847187.tar.gz
rust-d1708334312f654204edd21b3e93cf29da847187.zip
Auto merge of #112431 - Urgau:cast_ref_to_mut_improvments, r=Nilstrieb
Improve `invalid_reference_casting` lint

This PR is a follow-up to https://github.com/rust-lang/rust/pull/111567 and https://github.com/rust-lang/rust/pull/113422.

This PR does multiple things:
 - First it adds support for deferred de-reference, the goal is to support code like this, where the casting and de-reference are not done on the same expression
    ```rust
    let myself = self as *const Self as *mut Self;
    *myself = Self::Ready(value);
    ```
 - Second it does not lint anymore on SB/TB UB code by only checking assignments (`=`, `+=`, ...) and creation of mutable references `&mut *`
 - Thirdly it greatly improves the diagnostics in particular for cast from `&mut` to `&mut` or assignments
 - ~~And lastly it renames the lint from `cast_ref_to_mut` to `invalid_reference_casting` which is more consistent with the ["rules"](https://github.com/rust-lang/rust-clippy/issues/2845) and also more consistent with what the lint checks~~ *https://github.com/rust-lang/rust/pull/113422*

This PR is best reviewed commit by commit.

r? compiler
Diffstat (limited to 'compiler/rustc_parse/src')
0 files changed, 0 insertions, 0 deletions