[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <D8HVKRW45ESG.3NP8BPWF76RYT@proton.me>
Date: Sun, 16 Mar 2025 17:43:45 +0000
From: Benno Lossin <benno.lossin@...ton.me>
To: Tamir Duberstein <tamird@...il.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>, Andreas Hindborg <a.hindborg@...nel.org>, Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>, Bjorn Helgaas <bhelgaas@...gle.com>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>, "Rafael J. Wysocki" <rafael@...nel.org>, Danilo Krummrich <dakr@...nel.org>, rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org, linux-pci@...r.kernel.org
Subject: Re: [PATCH 2/2] rust: workqueue: remove HasWork::OFFSET
On Sun Mar 16, 2025 at 1:55 PM CET, Tamir Duberstein wrote:
> On Sat, Mar 15, 2025 at 2:12 PM Tamir Duberstein <tamird@...il.com> wrote:
>>
>> On Sat, Mar 15, 2025 at 2:06 PM Benno Lossin <benno.lossin@...ton.me> wrote:
>> >
>> > On Sat Mar 15, 2025 at 4:37 PM CET, Tamir Duberstein wrote:
>> > > On Sat, Mar 15, 2025 at 5:30 AM Benno Lossin <benno.lossin@...ton.me> wrote:
>> > >>
>> > >> On Fri Mar 14, 2025 at 9:44 PM CET, Tamir Duberstein wrote:
>> > >> > On Fri, Mar 14, 2025 at 3:20 PM Benno Lossin <benno.lossin@...ton.me> wrote:
>> > >> >>
>> > >> >> On Fri Mar 7, 2025 at 10:58 PM CET, Tamir Duberstein wrote:
>> > >> >> > /// Returns a pointer to the struct containing the [`Work<T, ID>`] field.
>> > >> >> > ///
>> > >> >> > /// # Safety
>> > >> >> > ///
>> > >> >> > /// The pointer must point at a [`Work<T, ID>`] field in a struct of type `Self`.
>> > >> >> > - #[inline]
>> > >> >> > - unsafe fn work_container_of(ptr: *mut Work<T, ID>) -> *mut Self
>> > >> >> > - where
>> > >> >> > - Self: Sized,
>> > >> >>
>> > >> >> This bound is required in order to allow the usage of `dyn HasWork` (ie
>> > >> >> object safety), so it should stay.
>> > >> >>
>> > >> >> Maybe add a comment explaining why it's there.
>> > >> >
>> > >> > I guess a doctest would be better, but I still don't understand why
>> > >> > the bound is needed. Sorry, can you cite something or explain in more
>> > >> > detail please?
>> > >>
>> > >> Here is a link: https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility
>> > >>
>> > >> But I realized that the trait wasn't object safe to begin with due to
>> > >> the `OFFSET` associated constant. So I'm not sure we need this. Alice,
>> > >> do you need `dyn HasWork`?
>> > >
>> > > I wrote a simple test:
>> >
>> > [...]
>> >
>> > > so I don't think adding the Sized bound makes sense - we'd end up
>> > > adding it on every item in the trait.
>> >
>> > Yeah the `Sized` bound was probably to make the cast work, so let's
>> > remove it.
>>
>> It's already removed, right?
>
> Ping. Can you help me understand what change, if any, you think is required?
No change required, with my reply above I intended to take my
complaint away :)
---
Cheers,
Benno
Powered by blists - more mailing lists