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: sync: lock: Add Lock::get_mut_pinned() Date: Thu, 04 Jun 2026 16:11:03 +1000 Message-ID: In-Reply-To: <20260529173137.303717-2-lyude@redhat.com> References: <20260529173137.303717-1-lyude@redhat.com> <20260529173137.303717-2-lyude@redhat.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 **Correctness: Good.** The implementation is sound. The method provides `Pin<&mut T>` from `Pin<&mut Lock>` without acqui= ring the lock, which is safe because `&mut` guarantees exclusive access. Th= is mirrors `std::sync::Mutex::get_mut()` from the Rust stdlib. ```rust pub fn get_mut_pinned(self: Pin<&mut Self>) -> Pin<&mut T> { // SAFETY: We return a pinned T, ensuring we don't move T. unsafe { self.map_unchecked_mut(|data| data.data.get_mut()) } } ``` The safety of `map_unchecked_mut` relies on the returned reference pointing= to structurally pinned data. Since `data: UnsafeCell` is `#[pin]` in th= e `Lock` struct definition (line 119 of `lock.rs`), this is correct. **Minor issues:** 1. **Commit message says "These two functions"** but only one function (`ge= t_mut_pinned`) is added. Likely a leftover from an earlier revision: > These two functions are inspired by the Rust stdlib equivalent 2. **`#[inline(always)]` is arguably too strong.** The method is trivial an= d the compiler will almost certainly inline it without the hint. `#[inline]= ` would suffice and avoids forcing inlining in debug builds. Very minor nit. 3. The method is placed in the `impl Lock` blo= ck, which is correct =E2=80=94 it works for unsized types and any backend. --- --- Generated by Claude Code Patch Reviewer