Subject: Re: linux-next: build failure after merge of the rust tree

From: Danilo Krummrich <[email-masked]>
Date: Tue, 24 Jun 2025 13:12:39 +0200

On Tue, Jun 24, 2025 at 12:31:52PM +0200, Miguel Ojeda wrote:
> By the way, I also noticed a Clippy warning in `nova-next` (on its
> own, i.e. without merging anything) -- please see below [1].

How do I get this warning to trigger? I did run my usual tests with rustc 1.78
and 1.87.

> [1]
> 
>     error: mutable borrow from immutable input(s)
>        --> rust/kernel/dma.rs:297:78
>         |
>     297 |     pub unsafe fn as_slice_mut(&self, offset: usize, count:
> usize) -> Result<&mut [T]> {

I think the method isn't wrong, it is unsafe and the safety requirement
explicitly covers this part.

However, we should consider changing it anyways.

>         |
>                 ^^^^^^^^
>         |
>     note: immutable borrow here
>        --> rust/kernel/dma.rs:297:32
>         |
>     297 |     pub unsafe fn as_slice_mut(&self, offset: usize, count:
> usize) -> Result<&mut [T]> {
>         |                                ^^^^^
>         = help: for further information visit
> https://rust-lang.github.io/rust-clippy/master/index.html#mut_from_ref
>         = note: `-D clippy::mut-from-ref` implied by `-D warnings`
>         = help: to override `-D warnings` add `#[allow(clippy::mut_from_ref)]`