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: ptr: add projection infrastructure Date: Tue, 10 Mar 2026 12:10:28 +1000 Message-ID: In-Reply-To: <20260309-drm-rust-next-v4-2-4ef485b19a4c@proton.me> References: <20260309-drm-rust-next-v4-0-4ef485b19a4c@proton.me> <20260309-drm-rust-next-v4-2-4ef485b19a4c@proton.me> 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 most complex patch and forms the core of the series. The design= is solid. **Deref guard**: The `ProjectField` trait's dual implementation (with `cons= t DEREF: bool`) to create ambiguity when a type implements `Deref` is cleve= r and prevents a real soundness issue. **Alignment check**: The `if false { let _ =3D &(*ptr).$field; }` trick to = reject `#[repr(packed)]` field projections at compile time is elegant =E2= =80=94 the compiler checks alignment even in dead code. **MaybeUninit approach** in `ProjectField::proj`: ```rust let mut place =3D MaybeUninit::uninit(); let place_base =3D place.as_mut_ptr(); let field =3D f(place_base); let offset =3D unsafe { field.byte_offset_from(place_base) }; base.wrapping_byte_offset(offset).cast() ``` The comment notes this should work even for very large `T` as the memory is= never used and should be optimized away. This is the same approach as the = `memoffset` crate. It's sound but relies on the optimizer =E2=80=94 for ext= remely large types, debug builds could theoretically cause stack issues her= e too. In practice this is fine. **`Makefile.build` changes**: Adding `slice_ptr_len` and `strict_provenance= ` to `rust_allowed_features` is correct and the comments correctly document= the stabilization versions. No blocking issues. --- Generated by Claude Code Patch Reviewer