[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABm2a9dGo1eMBAAUkEgtKoQ7w=Vdz8e4yw_prGnxj6v=mMq9_g@mail.gmail.com>
Date: Mon, 16 Jun 2025 22:55:09 -0300
From: Christian <christiansantoslima21@...il.com>
To: Alexandre Courbot <acourbot@...dia.com>
Cc: Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>, Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>, rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org, ~lkcamp/patches@...ts.sr.ht,
richard120310@...il.com
Subject: Re: [PATCH v7] rust: transmute: Add methods for FromBytes trait
> Or if that is still unclear, consider the following doctest in `dma.rs`
> that fails with this patch:
>
> struct MyStruct { field: u32, }
>
> // SAFETY: All bit patterns are acceptable values for `MyStruct`.
> unsafe impl kernel::transmute::FromBytes for MyStruct{};
> // SAFETY: Instances of `MyStruct` have no uninitialized portions.
> unsafe impl kernel::transmute::AsBytes for MyStruct{};
>
> It fails because the `FromBytes` implementation for `MyStruct` does not provide
> a definition for `from_bytes` and `from_mut_bytes`. Fixing this is just a
> matter of changing the `impl FromBytes` into `impl FromBytesSized`. But without
> the latter, how do you make this example build without providing a definition
> of `from_bytes` and `from_bytes_mut`?
Well, that's fine with me. I'll send the next patch with this fix. Can
I put it as `suggested-by`?
Thanks,
Christian
Powered by blists - more mailing lists