From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: rust: workqueue: add support for ARef Date: Wed, 25 Mar 2026 07:11:04 +1000 Message-ID: In-Reply-To: <20260323-aref-workitem-v3-1-f59729b812aa@collabora.com> References: <20260323-aref-workitem-v3-0-f59729b812aa@collabora.com> <20260323-aref-workitem-v3-1-f59729b812aa@collabora.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review This is the core patch, adding `WorkItemPointer`, `RawWorkItem`, and relate= d trait implementations for `ARef`. The implementation closely mirrors the `Arc` implementation, which is ap= propriate since both are refcounted smart pointers with similar ownership s= emantics. **Minor observations:** 1. In the `WorkItemPointer::run` implementation, the `work_container_of` ca= ll returns a `*mut T` (not `*const T`), but the comment says: ```rust // SAFETY: This computes the pointer that `__enqueue` got from // `ARef::into_raw`. let ptr =3D unsafe { T::work_container_of(ptr) }; ``` This is fine =E2=80=94 `ARef::into_raw` returns `NonNull` which wraps a = `*mut T` internally, so there's no const-to-mut cast issue here (unlike the= `Arc` version which needs `cast_mut()`). Good. 2. The `__enqueue` method: ```rust let ptr =3D ARef::into_raw(self); // SAFETY: Pointers from ARef::into_raw are valid and non-null. let work_ptr =3D unsafe { T::raw_get_work(ptr.as_ptr()) }; ``` This is correct. `ARef::into_raw` returns `NonNull`, so `.as_ptr()` give= s the `*mut T` needed by `raw_get_work`. The refcount ownership is properly= transferred: if `queue_work_on` returns true, the refcount is "leaked" to = the work queue; if false, it's reclaimed via `ARef::from_raw(ptr)`. 3. The trait bounds use `T: AlwaysRefCounted` separately from `T: WorkItem<= ID, Pointer =3D Self>`. This is slightly redundant since `ARef` already = requires `T: AlwaysRefCounted`, but being explicit is fine for clarity and = consistency with how the other impls are structured. Looks correct. --- Generated by Claude Code Patch Reviewer