rust/src/tools
bors ba1690bedd Auto merge of #111567 - Urgau:uplift_cast_ref_to_mut, r=b-naber
Uplift `clippy::cast_ref_to_mut` lint

This PR aims at uplifting the `clippy::cast_ref_to_mut` lint into rustc.

## `cast_ref_to_mut`

(deny-by-default)

The `cast_ref_to_mut` lint checks for casts of `&T` to `&mut T` without using interior mutability.

### Example

```rust,compile_fail
fn x(r: &i32) {
    unsafe {
        *(r as *const i32 as *mut i32) += 1;
    }
}
```

### Explanation

Casting `&T` to `&mut T` without interior mutability is undefined behavior, as it's a violation of Rust reference aliasing requirements.

-----

Mostly followed the instructions for uplifting a clippy lint described here: https://github.com/rust-lang/rust/pull/99696#pullrequestreview-1134072751

`@rustbot` label: +I-lang-nominated
r? compiler

-----

For Clippy:

changelog: Moves: Uplifted `clippy::cast_ref_to_mut` into rustc
2023-06-01 01:27:32 +00:00
..
build-manifest Promote loongarch64-unknown-linux-gnu to Tier 2 with host tools 2023-05-23 18:33:57 +08:00
build_helper create build_helper/src/util mod 2023-05-30 10:53:46 +03:00
bump-stage0 remove some unneeded imports 2023-04-12 19:27:18 +02:00
cargo@f7b95e3164 Update cargo 2023-05-31 00:08:30 +01:00
cargotest Override linker in cargotest on windows 2022-10-23 19:33:03 -05:00
clippy Drop uplifted clippy::cast_ref_to_mut 2023-05-31 13:42:53 +02:00
collect-license-metadata Fix remaining typos 2023-04-10 21:02:49 +02:00
compiletest Rollup merge of #111975 - jyn514:normalization, r=cjgillot 2023-05-31 11:19:07 +02:00
error_index_generator refactor: improve error-index-generator dependency 2023-02-26 20:13:06 +13:00
expand-yaml-anchors Run expand-yaml-anchors in x test tidy 2023-02-05 14:46:52 -06:00
generate-copyright Fix remaining typos 2023-04-10 21:02:49 +02:00
generate-windows-sys Sort windows_sys.lst alphabetically 2023-05-05 20:48:17 +01:00
html-checker
jsondocck Fix remaining typos 2023-04-10 21:02:49 +02:00
jsondoclint IAT: Rustdoc integration 2023-05-04 16:59:11 +02:00
linkchecker Appease lints 2023-05-14 22:00:23 +02:00
lint-docs Fix x test lint-docs when download-rustc is enabled 2023-04-18 23:08:48 -05:00
lld-wrapper fix lld-wrapper lld flavor detection 2022-09-07 14:51:54 +02:00
miri Adjust tests for newly uplifted cast_ref_to_mut lint 2023-05-31 13:42:53 +02:00
miropt-test-tools add passes to miroptfiles struct and passed to -zdump-mir args 2023-05-04 18:56:32 -04:00
remote-test-client tools/remote-test-{server,client}: Use /data/local/tmp on Android 2022-10-06 13:42:32 -07:00
remote-test-server Use u32 methods instead of manual shifting 2022-12-23 16:08:23 +05:30
replace-version-placeholder Only depend on CFG_VERSION in rustc_interface 2023-05-17 23:54:21 -05:00
rls chore: remove rustc-workspace-hack 2023-04-16 19:32:20 +01:00
rust-analyzer Update proc-macro-api for the new rustc metadata format 2023-05-26 11:59:25 -05:00
rust-demangler
rust-installer Improve comments 2023-05-25 08:14:33 -07:00
rustbook bump few deps 2023-04-06 18:21:37 +03:00
rustdoc rustdoc: Use unix_sigpipe instead of rustc_driver::set_sigpipe_handler 2022-10-24 20:40:46 +02:00
rustdoc-gui Migrate to 0.16.0 browser-ui-test version 2023-05-11 11:34:22 +02:00
rustdoc-gui-test use build_helper::util::try_run in rustdoc-gui-test 2023-05-30 10:54:40 +03:00
rustdoc-js rustdoc: restructure type search engine to pick-and-use IDs 2023-04-17 12:16:54 -07:00
rustdoc-themes
rustfmt Rollup merge of #110989 - jyn514:bug-report-url, r=WaffleLapkin 2023-05-06 13:30:04 +02:00
suggest-tests Fix the test directories suggested by ./x.py suggest 2023-04-30 11:05:13 +10:00
tidy Auto merge of #111076 - notriddle:notriddle/silence-private-dep-trait-impl-suggestions, r=cjgillot 2023-05-31 13:47:36 +00:00
tier-check Encourage developers not to use periods in target names 2022-11-17 10:41:41 +01:00
unicode-table-generator remove some unneeded imports 2023-04-12 19:27:18 +02:00
unstable-book-gen unstable-book-gen: use std::fs::write 2022-08-28 00:40:58 +02:00
x make x look for x.py if shell script does not exist 2023-02-15 15:19:49 +08:00
cherry-pick.sh
publish_toolstate.py rename maybe_delink to maybe_remove_mention 2023-04-11 14:04:50 +02:00