Re: [PATCH v2 3/3] rust: Support deriving `AsBytes`/`FromBytes` on bindgen types

From: Alexandre Courbot

Date: Tue Dec 16 2025 - 22:16:14 EST


On Tue Dec 16, 2025 at 9:44 AM JST, Matthew Maurer wrote:
> To support this, we need to move the `transmute` module into a separate
> crate to allow the `bindings` crate to depend on it. Most user code is
> still expected to address the module as `kernel::transmute`, which is a
> re-export. `ffi::transmute` is now available for use in `bindings`.
>
> Signed-off-by: Matthew Maurer <mmaurer@xxxxxxxxxx>

Maybe this should be two commits, one for the new crate, another one to
introduce the ability to use on bindgen types.

I have tried this with the Nova bindings, and somehow could not get past
this error:

error[E0433]: failed to resolve: could not find `ffi` in the list of imported crates
--> ../drivers/gpu/nova-core/gsp/fw/r570_144/bindings.rs:321:54
|
321 | #[derive(Debug, Default, Copy, Clone, MaybeZeroable, FromBytesFfi)]
| ^^^^^^^^^^^^ could not find `ffi` in the list of imported crates
|
= note: this error originates in the derive macro `FromBytesFfi` (in Nightly builds, run with -Z macro-backtrace for more info)

I do have `kernel::ffi` imported in the bindings module though, so I am
not quite sure what this is about. Any idea?