public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: rust: ptr: add projection infrastructure
Date: Tue, 10 Mar 2026 12:10:28 +1000	[thread overview]
Message-ID: <review-patch2-20260309-drm-rust-next-v4-2-4ef485b19a4c@proton.me> (raw)
In-Reply-To: <20260309-drm-rust-next-v4-2-4ef485b19a4c@proton.me>

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 `const DEREF: bool`) to create ambiguity when a type implements `Deref` is clever and prevents a real soundness issue.

**Alignment check**: The `if false { let _ = &(*ptr).$field; }` trick to reject `#[repr(packed)]` field projections at compile time is elegant — the compiler checks alignment even in dead code.

**MaybeUninit approach** in `ProjectField::proj`:

```rust
let mut place = MaybeUninit::uninit();
let place_base = place.as_mut_ptr();
let field = f(place_base);
let offset = 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 — for extremely large types, debug builds could theoretically cause stack issues here 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

  reply	other threads:[~2026-03-10  2:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-09 16:34 [PATCH v4 0/4] Fixes the stack overflow Tim Kovalenko via B4 Relay
2026-03-09 16:34 ` [PATCH v4 1/4] rust: ptr: add `KnownSize` trait to support DST size info extraction Tim Kovalenko via B4 Relay
2026-03-10  2:10   ` Claude review: " Claude Code Review Bot
2026-03-09 16:34 ` [PATCH v4 2/4] rust: ptr: add projection infrastructure Tim Kovalenko via B4 Relay
2026-03-10  2:10   ` Claude Code Review Bot [this message]
2026-03-09 16:34 ` [PATCH v4 3/4] rust: dma: use pointer projection infra for `dma_{read,write}` macro Tim Kovalenko via B4 Relay
2026-03-10  2:10   ` Claude review: " Claude Code Review Bot
2026-03-09 16:34 ` [PATCH v4 4/4] gpu: nova-core: fix stack overflow in GSP memory allocation Tim Kovalenko via B4 Relay
2026-03-09 19:40   ` Danilo Krummrich
2026-03-09 22:40     ` Miguel Ojeda
2026-03-10  1:40   ` Alexandre Courbot
2026-03-10  1:51     ` Gary Guo
2026-03-10  2:10   ` Claude review: " Claude Code Review Bot
2026-03-09 17:00 ` [PATCH v4 0/4] Fixes the stack overflow Danilo Krummrich
2026-03-10  2:10 ` Claude review: " Claude Code Review Bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=review-patch2-20260309-drm-rust-next-v4-2-4ef485b19a4c@proton.me \
    --to=claude-review@example.com \
    --cc=dri-devel-reviews@example.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox