Skip to content
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

Improve invalid_reference_casting lint #112431

Merged
merged 5 commits into from
Aug 2, 2023

Conversation

Urgau
Copy link
Member

@Urgau Urgau commented Jun 8, 2023

This PR is a follow-up to #111567 and #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
    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" and also more consistent with what the lint checks Rename and allow cast_ref_to_mut lint #113422

This PR is best reviewed commit by commit.

r? compiler

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 8, 2023
@rustbot
Copy link
Collaborator

rustbot commented Jun 8, 2023

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@Urgau Urgau force-pushed the cast_ref_to_mut_improvments branch 2 times, most recently from 54bef35 to 01cb874 Compare June 8, 2023 21:17
@rustbot
Copy link
Collaborator

rustbot commented Jun 8, 2023

The Miri subtree was changed

cc @rust-lang/miri

@Urgau Urgau force-pushed the cast_ref_to_mut_improvments branch 2 times, most recently from c9956a9 to fc7e634 Compare June 10, 2023 17:32
@Urgau
Copy link
Member Author

Urgau commented Jun 20, 2023

r? compiler

@rustbot rustbot assigned jackh726 and unassigned eholk Jun 20, 2023
@bors
Copy link
Contributor

bors commented Jun 29, 2023

☔ The latest upstream changes (presumably #113151) made this pull request unmergeable. Please resolve the merge conflicts.

@Urgau Urgau force-pushed the cast_ref_to_mut_improvments branch from add632a to 1f84677 Compare June 29, 2023 15:39
@rust-log-analyzer

This comment has been minimized.

@Urgau Urgau force-pushed the cast_ref_to_mut_improvments branch from 1f84677 to 7ec9794 Compare June 29, 2023 16:27
@eholk
Copy link
Contributor

eholk commented Jun 29, 2023

For the SB comments, is the idea that these are UB per Stacked Borrows, but not necessarily actually UB? For example, are these examples allowed under Tree Borrows?

@Urgau
Copy link
Member Author

Urgau commented Jun 30, 2023

For the SB comments, is the idea that these are UB per Stacked Borrows, but not necessarily actually UB?

Yes, those are UB under Stacked Borrows. As to when ever those are actually UB, I have no idea.

For example, are these examples allowed under Tree Borrows?

Maybe, I don't know and it shouldn't matter. Neither Stacked Borrows or Tree Borrows are official, so we shouldn't strive for either of them.


There is another thing to take into account, when uplifting the lint T-lang only officially approved linting for &T -> &mut T casts, so checking for anything more is already borderline.

With this PR only &T -> &mut T and *(&T -> &mut T) = ... are linted against instead of everything that de-reference the result of an immutable-ref to (mut/const) pointer casting.

@Urgau Urgau force-pushed the cast_ref_to_mut_improvments branch from 7ec9794 to 85fac39 Compare June 30, 2023 22:02
@bors
Copy link
Contributor

bors commented Jul 2, 2023

☔ The latest upstream changes (presumably #113260) made this pull request unmergeable. Please resolve the merge conflicts.

@Urgau Urgau force-pushed the cast_ref_to_mut_improvments branch from 85fac39 to c68706f Compare July 2, 2023 19:31
@Urgau
Copy link
Member Author

Urgau commented Jul 3, 2023

r? @Nilstrieb (per Zulip discussion)

@rustbot rustbot assigned Nilstrieb and unassigned jackh726 Jul 3, 2023
Copy link
Member

@Nilstrieb Nilstrieb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some feedback and a question around UnsafeCell.

The original PR will land in 1.72.0 (nightly, beta in a few days). The rename should really get into the same release, so can you split it out into a separate PR to avoid it being caught up in bikeshedding here?

@@ -1893,7 1893,8 @@ impl<T: ?Sized fmt::Display> fmt::Display for RefMut<'_, T> {
/// on an _exclusive_ `UnsafeCell<T>`. Even though `T` and `UnsafeCell<T>` have the
/// same memory layout, the following is not allowed and undefined behavior:
///
/// ```rust,no_run
#[cfg_attr(bootstrap, doc = "```rust,no_run")]
#[cfg_attr(not(bootstrap), doc = "```rust,compile_fail")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an interesting case. It's a UB example but it's also something that's fine in both SB and TB as they don't care about get at all, so it seems likely to be fine in the future. Avoiding to lint here is quite easy by just checking whether the pointee has interior mutability with !pointee.is_freeze(), but I'm afraid that this would cause the lint to miss more subtle cases where the type has interior mutability somewhere deeply nested.
@RalfJung what's your opinion on this here? Should the compiler emit a deny-by-default lint on this code below?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am totally fine with linting against this, calling get is a lot more clear and the docs for UnsafeCell explicitly say this is UB. It might be "just" library UB instead of language UB, but that's still good enough to justify a lint IMO. We can always revisit this once we have an official aliasing model.

compiler/rustc_lint/src/reference_casting.rs Outdated Show resolved Hide resolved
compiler/rustc_lint/src/reference_casting.rs Outdated Show resolved Hide resolved
@Urgau Urgau force-pushed the cast_ref_to_mut_improvments branch from 9724a74 to 507d497 Compare July 29, 2023 10:37
@Urgau Urgau changed the title Improve cast_ref_to_mut lint Improve invalid_reference_casting lint Jul 29, 2023
@Urgau
Copy link
Member Author

Urgau commented Jul 29, 2023

#113422 has now been merged. I've rebased. This PR is no longer blocked and is ready for another review.

@rustbot label: -S-blocked S-waiting-on-review

@rustbot rustbot removed the S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. label Jul 29, 2023
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Jul 30, 2023
Rename and allow `cast_ref_to_mut` lint

This PR is a small subset of rust-lang/rust#112431, that is the renaming of the lint (`cast_ref_to_mut` -> `invalid_reference_casting`).

BUT also temporarily change the default level of the lint from deny-by-default to allow-by-default until rust-lang/rust#112431 is merged.

r? `@Nilstrieb`
@Nilstrieb
Copy link
Member

@bors r

@bors
Copy link
Contributor

bors commented Aug 2, 2023

📌 Commit 507d497 has been approved by Nilstrieb

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 2, 2023
@bors
Copy link
Contributor

bors commented Aug 2, 2023

⌛ Testing commit 507d497 with merge d170833...

@bors
Copy link
Contributor

bors commented Aug 2, 2023

☀️ Test successful - checks-actions
Approved by: Nilstrieb
Pushing d170833 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 2, 2023
@bors bors merged commit d170833 into rust-lang:master Aug 2, 2023
12 checks passed
@rustbot rustbot added this to the 1.73.0 milestone Aug 2, 2023
@Urgau Urgau deleted the cast_ref_to_mut_improvments branch August 2, 2023 13:42
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (d170833): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.4% [0.4%, 0.4%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.2% [-2.2%, -2.2%] 2
Improvements ✅
(secondary)
-3.6% [-4.6%, -2.5%] 2
All ❌✅ (primary) -2.2% [-2.2%, -2.2%] 2

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 647.763s -> 648.737s (0.15%)

flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request Aug 10, 2023
Rename and allow `cast_ref_to_mut` lint

This PR is a small subset of rust-lang/rust#112431, that is the renaming of the lint (`cast_ref_to_mut` -> `invalid_reference_casting`).

BUT also temporarily change the default level of the lint from deny-by-default to allow-by-default until rust-lang/rust#112431 is merged.

r? `@Nilstrieb`
wip-sync pushed a commit to NetBSD/pkgsrc-wip that referenced this pull request Oct 6, 2023
Language
--------

- [Uplift `clippy::fn_null_check` lint as `useless_ptr_null_checks`.]
  (rust-lang/rust#111717)
- [Make `noop_method_call` warn by default.]
  (rust-lang/rust#111916)
- [Support interpolated block for `try` and `async` in macros.]
  (rust-lang/rust#112953)
- [Make `unconditional_recursion` lint detect recursive drops.]
  (rust-lang/rust#113902)
- [Future compatibility warning for some impls being incorrectly
  considered not overlapping.]
  (rust-lang/rust#114023)
- [The `invalid_reference_casting` lint is now **deny-by-default**
  (instead of allow-by-default)]
  (rust-lang/rust#112431)

Compiler
--------

- [Write version information in a `.comment` section like GCC/Clang.]
  (rust-lang/rust#97550)
- [Add documentation on v0 symbol mangling.]
  (rust-lang/rust#97571)
- [Stabilize `extern "thiscall"` and `"thiscall-unwind"` ABIs.]
  (rust-lang/rust#114562)
- [Only check outlives goals on impl compared to trait.]
  (rust-lang/rust#109356)
- [Infer type in irrefutable slice patterns with fixed length as array.]
  (rust-lang/rust#113199)
- [Discard default auto trait impls if explicit ones exist.]
  (rust-lang/rust#113312)
- Add several new tier 3 targets:
    - [`aarch64-unknown-teeos`]
      (rust-lang/rust#113480)
    - [`csky-unknown-linux-gnuabiv2`]
      (rust-lang/rust#113658)
    - [`riscv64-linux-android`]
      (rust-lang/rust#112858)
    - [`riscv64gc-unknown-hermit`]
      (rust-lang/rust#114004)
    - [`x86_64-unikraft-linux-musl`]
      (rust-lang/rust#113411)
    - [`x86_64-unknown-linux-ohos`]
      (rust-lang/rust#113061)
- [Add `wasm32-wasi-preview1-threads` as a tier 2 target.]
  (rust-lang/rust#112922)

Refer to Rust's [platform support page][platform-support-doc]
for more information on Rust's tiered platform support.

Libraries
---------

- [Add `Read`, `Write` and `Seek` impls for `Arc<File>`.]
  (rust-lang/rust#94748)
- [Merge functionality of `io::Sink` into `io::Empty`.]
  (rust-lang/rust#98154)
- [Implement `RefUnwindSafe` for `Backtrace`]
  (rust-lang/rust#100455)
- [Make `ExitStatus` implement `Default`]
  (rust-lang/rust#106425)
- [`impl SliceIndex<str> for (Bound<usize>, Bound<usize>)`]
  (rust-lang/rust#111081)
- [Change default panic handler message format.]
  (rust-lang/rust#112849)
- [Cleaner `assert_eq!` & `assert_ne!` panic messages.]
  (rust-lang/rust#111071)
- [Correct the (deprecated) Android `stat` struct definitions.]
  (rust-lang/rust#113130)

Stabilized APIs
---------------

- [Unsigned `{integer}::div_ceil`]
  (https://doc.rust-lang.org/stable/std/primitive.u32.html#method.div_ceil)
- [Unsigned `{integer}::next_multiple_of`]
  (https://doc.rust-lang.org/stable/std/primitive.u32.html#method.next_multiple_of)
- [Unsigned `{integer}::checked_next_multiple_of`]
  (https://doc.rust-lang.org/stable/std/primitive.u32.html#method.checked_next_multiple_of)
- [`std::ffi::FromBytesUntilNulError`]
  (https://doc.rust-lang.org/stable/std/ffi/struct.FromBytesUntilNulError.html)
- [`std::os::unix::fs::chown`]
  (https://doc.rust-lang.org/stable/std/os/unix/fs/fn.chown.html)
- [`std::os::unix::fs::fchown`]
  (https://doc.rust-lang.org/stable/std/os/unix/fs/fn.fchown.html)
- [`std::os::unix::fs::lfchown`]
  (https://doc.rust-lang.org/stable/std/os/unix/fs/fn.lchown.html)
- [`LocalKey::<Cell<T>>::get`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.get)
- [`LocalKey::<Cell<T>>::set`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.set)
- [`LocalKey::<Cell<T>>::take`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.take)
- [`LocalKey::<Cell<T>>::replace`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.replace)
- [`LocalKey::<RefCell<T>>::with_borrow`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.with_borrow)
- [`LocalKey::<RefCell<T>>::with_borrow_mut`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.with_borrow_mut)
- [`LocalKey::<RefCell<T>>::set`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.set-1)
- [`LocalKey::<RefCell<T>>::take`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.take-1)
- [`LocalKey::<RefCell<T>>::replace`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.replace-1)

These APIs are now stable in const contexts:

- [`rc::Weak::new`]
  (https://doc.rust-lang.org/stable/alloc/rc/struct.Weak.html#method.new)
- [`sync::Weak::new`]
  (https://doc.rust-lang.org/stable/alloc/sync/struct.Weak.html#method.new)
- [`NonNull::as_ref`]
  (https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.as_ref)

Cargo
-----

- [Encode URL params correctly for `SourceId` in `Cargo.lock`.]
  (rust-lang/cargo#12280)
- [Bail out an error when using `cargo::` in custom build script.]
  (rust-lang/cargo#12332)

Compatibility Notes
-------------------

- [Update the minimum external LLVM to 15.]
  (rust-lang/rust#114148)
- [Check for non-defining uses of return position `impl Trait`.]
  (rust-lang/rust#112842)

Internal Changes
----------------

These changes do not affect any public interfaces of Rust, but they represent
significant improvements to the performance or internals of rustc and related
tools.

- [Remove LLVM pointee types, supporting only opaque pointers.]
  (rust-lang/rust#105545)
- [Port PGO/LTO/BOLT optimized build pipeline to Rust.]
  (rust-lang/rust#112235)
- [Replace in-tree `rustc_apfloat` with the new version of the crate.]
  (rust-lang/rust#113843)
- [Update to LLVM 17.]
  (rust-lang/rust#114048)
- [Add `internal_features` lint for internal unstable features.]
  (rust-lang/rust#108955)
- [Mention style for new syntax in tracking issue template.]
  (rust-lang/rust#113586)
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Nov 16, 2023
Pkgsrc changes:
 * Adjust patches and cargo checksums to new versions.
 * For an external LLVM, set dependency of llvm >= 15, in accordance
   with the upstream changes.
 * Add a patch with a backport from LLVM 17.0.3 fixing codegen for
   PPC, ref. rust-lang/rust#116845

Upstream changes:

Version 1.73.0 (2023-10-05)
==========================

Language
--------

- [Uplift `clippy::fn_null_check` lint as `useless_ptr_null_checks`.]
  (rust-lang/rust#111717)
- [Make `noop_method_call` warn by default.]
  (rust-lang/rust#111916)
- [Support interpolated block for `try` and `async` in macros.]
  (rust-lang/rust#112953)
- [Make `unconditional_recursion` lint detect recursive drops.]
  (rust-lang/rust#113902)
- [Future compatibility warning for some impls being incorrectly
  considered not overlapping.]
  (rust-lang/rust#114023)
- [The `invalid_reference_casting` lint is now **deny-by-default**
  (instead of allow-by-default)]
  (rust-lang/rust#112431

Compiler
--------

- [Write version information in a `.comment` section like GCC/Clang.]
  (rust-lang/rust#97550)
- [Add documentation on v0 symbol mangling.]
  (rust-lang/rust#97571)
- [Stabilize `extern "thiscall"` and `"thiscall-unwind"` ABIs.]
  (rust-lang/rust#114562)
- [Only check outlives goals on impl compared to trait.]
  (rust-lang/rust#109356)
- [Infer type in irrefutable slice patterns with fixed length as array.]
  (rust-lang/rust#113199)
- [Discard default auto trait impls if explicit ones exist.]
  (rust-lang/rust#113312)
- Add several new tier 3 targets:
    - [`aarch64-unknown-teeos`]
      (rust-lang/rust#113480)
    - [`csky-unknown-linux-gnuabiv2`]
      (rust-lang/rust#113658)
    - [`riscv64-linux-android`]
      (rust-lang/rust#112858)
    - [`riscv64gc-unknown-hermit`]
      (rust-lang/rust#114004)
    - [`x86_64-unikraft-linux-musl`]
      (rust-lang/rust#113411)
    - [`x86_64-unknown-linux-ohos`]
      (rust-lang/rust#113061)
- [Add `wasm32-wasi-preview1-threads` as a tier 2 target.]
  (rust-lang/rust#112922)

Refer to Rust's [platform support page][platform-support-doc]
for more information on Rust's tiered platform support.

Libraries
---------

- [Add `Read`, `Write` and `Seek` impls for `Arc<File>`.]
  (rust-lang/rust#94748)
- [Merge functionality of `io::Sink` into `io::Empty`.]
  (rust-lang/rust#98154)
- [Implement `RefUnwindSafe` for `Backtrace`]
  (rust-lang/rust#100455)
- [Make `ExitStatus` implement `Default`]
  (rust-lang/rust#106425)
- [`impl SliceIndex<str> for (Bound<usize>, Bound<usize>)`]
  (rust-lang/rust#111081)
- [Change default panic handler message format.]
  (rust-lang/rust#112849)
- [Cleaner `assert_eq!` & `assert_ne!` panic messages.]
  (rust-lang/rust#111071)
- [Correct the (deprecated) Android `stat` struct definitions.]
  (rust-lang/rust#113130)

Stabilized APIs
---------------

- [Unsigned `{integer}::div_ceil`]
  (https://doc.rust-lang.org/stable/std/primitiv e.u32.html#method.div_ceil)
- [Unsigned `{integer}::next_multiple_of`]
  (https://doc.rust-lang.org/stable/std/primitive.u32.html#method.next_multiple_of)
- [Unsigned `{integer}::checked_next_multiple_of`]
  (https://doc.rust-lang.org/stable/std/primitive.u32.html#method.checked_next_multiple_of)
- [`std::ffi::FromBytesUntilNulError`]
  (https://doc.rust-lang.org/stable/std/ffi/struct.FromBytesUntilNulError.html)
- [`std::os::unix::fs::chown`]
  (https://doc.rust-lang.org/stable/std/os/unix/fs/fn.chown.html)
- [`std::os::unix::fs::fchown`]
  (https://doc.rust-lang.org/stable/std/os/unix/fs/fn.fchown.html)
- [`std::os::unix::fs::lfchown`]
  (https://doc.rust-lang.org/stable/std/os/unix/fs/fn.lchown.html)
- [`LocalKey::<Cell<T>>::get`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.get)
- [`LocalKey::<Cell<T>>::set`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.set)
- [`LocalKey::<Cell<T>>::take`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.take)
- [`LocalKey::<Cell<T>>::replace`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.replace)
- [`LocalKey::<RefCell<T>>::with_borrow`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.with_borrow)
- [`LocalKey::<RefCell<T>>::with_borrow_mut`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.with_borrow_mut)
- [`LocalKey::<RefCell<T>>::set`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.set-1)
- [`LocalKey::<RefCell<T>>::take`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.take-1)
- [`LocalKey::<RefCell<T>>::replace`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.replace-1)

These APIs are now stable in const contexts:

- [`rc::Weak::new`]
  (https://doc.rust-lang.org/stable/alloc/rc/struct.Weak.html#method.new)
- [`sync::Weak::new`]
  (https://doc.rust-lang.org/stable/alloc/sync/struct.Weak.html#method.new)
- [`NonNull::as_ref`]
  (https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.as_ref)

Cargo
-----

- [Encode URL params correctly for `SourceId` in `Cargo.lock`.]
  (rust-lang/cargo#12280)
- [Bail out an error when using `cargo::` in custom build script.]
  (rust-lang/cargo#12332)

Misc
----

Compatibility Notes
-------------------

- [Update the minimum external LLVM to 15.]
  (rust-lang/rust#114148)
- [Check for non-defining uses of return position `impl Trait`.]
  (rust-lang/rust#112842)

Internal Changes
----------------

These changes do not affect any public interfaces of Rust, but they
represent significant improvements to the performance or internals
of rustc and related tools.

- [Remove LLVM pointee types, supporting only opaque pointers.]
  (rust-lang/rust#105545)
- [Port PGO/LTO/BOLT optimized build pipeline to Rust.]
  (rust-lang/rust#112235)
- [Replace in-tree `rustc_apfloat` with the new version of the crate.]
  (rust-lang/rust#113843)
- [Update to LLVM 17.]
  (rust-lang/rust#114048)
- [Add `internal_features` lint for internal unstable features.]
  (rust-lang/rust#108955)
- [Mention style for new syntax in tracking issue template.]
  (rust-lang/rust#113586)
lnicola pushed a commit to lnicola/rust-analyzer that referenced this pull request Apr 7, 2024
Rename and allow `cast_ref_to_mut` lint

This PR is a small subset of rust-lang/rust#112431, that is the renaming of the lint (`cast_ref_to_mut` -> `invalid_reference_casting`).

BUT also temporarily change the default level of the lint from deny-by-default to allow-by-default until rust-lang/rust#112431 is merged.

r? `@Nilstrieb`
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this pull request Apr 27, 2024
Rename and allow `cast_ref_to_mut` lint

This PR is a small subset of rust-lang/rust#112431, that is the renaming of the lint (`cast_ref_to_mut` -> `invalid_reference_casting`).

BUT also temporarily change the default level of the lint from deny-by-default to allow-by-default until rust-lang/rust#112431 is merged.

r? `@Nilstrieb`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants