Re: [PATCH v4 3/3] rust: workqueue: add creation of workqueues

From: Alice Ryhl

Date: Sat Mar 14 2026 - 06:35:08 EST


On Fri, Mar 13, 2026 at 01:29:41PM +0000, Gary Guo wrote:
> On Fri Mar 13, 2026 at 1:25 PM GMT, Gary Guo wrote:
> > On Thu Mar 12, 2026 at 10:56 PM GMT, Alice Ryhl wrote:
> >> On Thu, Mar 12, 2026 at 04:39:00PM +0000, Gary Guo wrote:
> >>> > + flags: bindings::wq_flags,
> >>> > + max_active: i32,
> >>> > + _type: PhantomData<T>,
> >>>
> >>> Hmm, it is somewhat awkward to me that we are having a `PhantomData<T>` here,
> >>> as `PhantomData` is documented to "behave as it it owns a `T`", but all the
> >>> possible `T`s that we use here are uninhabited.
> >>
> >> I don't think this is an issue.
> >
> > Fair. I also don't think it's an issue, just awkward.
> >
> > I would rather make the uninhabited enums be just unit structs, though (like what we do
> > for atomic ordering and device contexts).
>
> One interesting idea with unit structs, is to allow the type to be passed in as
> argument rather than having multiple new_ variants:
>
> Queue::builder(wq::TypeUnbound).max_active(..).build(...)
>
> This is the trick that we use to make atomic API looks nice, although in this
> case it seems that it's not worth the hassle as it needs an extra import...

Yeah, I don't think this is worth it at all.

Alice