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

Miguel Ojeda
2025-06-24T10:32:04Z

On Tue, Jun 24, 2025 at 9:31 AM Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> error[E0277]: the trait bound `u32: From<DmaTrfCmdSize>` is not satisfied

> error[E0599]: no method named `as_nanos` found for struct `Delta` in the current scope

> Presumably caused by commit
>
> b7c8d7a8d251 ("rust: enable `clippy::cast_lossless` lint")

The first error, yes -- the `register!` macro was changed to use
`u32::from()` to avoid an `as` cast in that commit, and while the cast
is OK converting the new `enum`s like `FalconCoreRev`, `from()`
isn't`, so we would need to implement `From` explicitly -- Cc'ing
Danilo, Alexandre, Lyude.

The second error is due to 2ed94606a0fe ("rust: time: Rename Delta's
methods from as_* to into_*"). However, I am not sure why that patch
was applied since we were discussing the naming of those methods
elsewhere -- Cc'ing Andreas and Tomonori.

Nevertheless, even if 2ed94606a0fe is dropped (or the conflict solved
by a trivial rename), there will be another nearby conflict after that
one, due the addition of the `ClockSource` generic parameter, so that
needs a change too, e.g. using `Monotonic` explicitly if that is
correct or allowing the caller to pass a `ClockSource`.

By the way, I also noticed a Clippy warning in `nova-next` (on its
own, i.e. without merging anything) -- please see below [1].

I hope this helps.

Cheers,
Miguel

[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]> {
|
^^^^^^^^
|
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)]`