drivers/gpu/nova-core/gsp/cmdq.rs | 6 +-- rust/kernel/dma.rs | 15 +++--- rust/kernel/ptr/projection.rs | 97 +++++++++++++++++++++++++++++++-------- samples/rust/rust_dma.rs | 12 ++--- 4 files changed, 93 insertions(+), 37 deletions(-)
This series reworks the index projection syntax in the pointer
projection infrastructure to use the keyworded syntax to be more explicit.
Doing this allows adding a new panicking variant of index projection,
just like the normal index operator. This is useful for cases where
compiler cannot prove (or cannot reliably prove) access is inbounds.
The new syntax looks like this:
- `[try: index]`: Fallible indexing (replaces `[index]?`).
- `[build: index]`: Build-time checked indexing (replaces `[index]`).
- `[panic: index]`: Runtime panicking indexing (newly added).
DMA sample driver and nova core is updated.
Danilo, we previously discussed merging this series with I/O projection for
patch logistics. However, I'll need more time for next version of I/O
projection (implementing view types that have original container type
erased) which won't make it this cycle. This new version for projection
syntax rework is minor changes only comparde to v1, so I think it's worth
sending out so it can still land this cycle and get out of the way.
---
Changes in v2:
- Fix missing colon in documentation (Alice)
- Reworded safety comment (Andreas)
- Convert `unwrap_or_else` to match (Alice)
- Split rename of `index` to `build_index` to a separate patch (Alex)
- Dropped nova cmdq refactor as this will be better served in the I/O
projection series.
- Link to v1: https://patch.msgid.link/20260415-projection-syntax-rework-v1-0-450723cb3727@garyguo.net
To: Miguel Ojeda <ojeda@kernel.org>
To: Boqun Feng <boqun@kernel.org>
To: Gary Guo <gary@garyguo.net>
To: Björn Roy Baron <bjorn3_gh@protonmail.com>
To: Benno Lossin <lossin@kernel.org>
To: Andreas Hindborg <a.hindborg@kernel.org>
To: Alice Ryhl <aliceryhl@google.com>
To: Trevor Gross <tmgross@umich.edu>
To: Danilo Krummrich <dakr@kernel.org>
To: Abdiel Janulgue <abdiel.janulgue@gmail.com>
To: Daniel Almeida <daniel.almeida@collabora.com>
To: Robin Murphy <robin.murphy@arm.com>
To: Alexandre Courbot <acourbot@nvidia.com>
To: David Airlie <airlied@gmail.com>
To: Simona Vetter <simona@ffwll.ch>
Cc: rust-for-linux@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: driver-core@lists.linux.dev
Cc: nova-gpu@lists.linux.dev
Cc: dri-devel@lists.freedesktop.org
---
Gary Guo (6):
rust: ptr: rename `ProjectIndex::index` to `build_index`
rust: ptr: use `match` instead of `unwrap_or_else` for `build_index`
rust: ptr: add panicking index projection variant
rust: dma: update to keyworded index projection syntax
gpu: nova-core: convert to keyworded projection syntax
rust: ptr: remove implicit index projection syntax
drivers/gpu/nova-core/gsp/cmdq.rs | 6 +--
rust/kernel/dma.rs | 15 +++---
rust/kernel/ptr/projection.rs | 97 +++++++++++++++++++++++++++++++--------
samples/rust/rust_dma.rs | 12 ++---
4 files changed, 93 insertions(+), 37 deletions(-)
---
base-commit: 46def663dd34da36464ba059f7cfeacf29d98e5e
change-id: 20260415-projection-syntax-rework-b790a305bc52
Best regards,
--
Gary Guo <gary@garyguo.net>
On Tue, Jun 2, 2026 at 4:18 PM Gary Guo <gary@garyguo.net> wrote: > > This series reworks the index projection syntax in the pointer > projection infrastructure to use the keyworded syntax to be more explicit. > > Doing this allows adding a new panicking variant of index projection, > just like the normal index operator. This is useful for cases where > compiler cannot prove (or cannot reliably prove) access is inbounds. > > The new syntax looks like this: > - `[try: index]`: Fallible indexing (replaces `[index]?`). > - `[build: index]`: Build-time checked indexing (replaces `[index]`). > - `[panic: index]`: Runtime panicking indexing (newly added). > > DMA sample driver and nova core is updated. > > Danilo, we previously discussed merging this series with I/O projection for > patch logistics. However, I'll need more time for next version of I/O > projection (implementing view types that have original container type > erased) which won't make it this cycle. This new version for projection > syntax rework is minor changes only comparde to v1, so I think it's worth > sending out so it can still land this cycle and get out of the way. Reviewed-by: Alice Ryhl <aliceryhl@google.com>
On Tue Jun 2, 2026 at 4:17 PM CEST, Gary Guo wrote: > Danilo, we previously discussed merging this series with I/O projection for > patch logistics. However, I'll need more time for next version of I/O > projection (implementing view types that have original container type > erased) which won't make it this cycle. This new version for projection > syntax rework is minor changes only comparde to v1, so I think it's worth > sending out so it can still land this cycle and get out of the way. [...] > base-commit: 46def663dd34da36464ba059f7cfeacf29d98e5e Agreed, as discussed; and in this case I think this can go through rust-next. Acked-by: Danilo Krummrich <dakr@kernel.org>
On Tue, Jun 2, 2026 at 4:18 PM Gary Guo <gary@garyguo.net> wrote:
>
> This series reworks the index projection syntax in the pointer
> projection infrastructure to use the keyworded syntax to be more explicit.
>
> Doing this allows adding a new panicking variant of index projection,
> just like the normal index operator. This is useful for cases where
> compiler cannot prove (or cannot reliably prove) access is inbounds.
>
> The new syntax looks like this:
> - `[try: index]`: Fallible indexing (replaces `[index]?`).
> - `[build: index]`: Build-time checked indexing (replaces `[index]`).
> - `[panic: index]`: Runtime panicking indexing (newly added).
>
> DMA sample driver and nova core is updated.
>
> Danilo, we previously discussed merging this series with I/O projection for
> patch logistics. However, I'll need more time for next version of I/O
> projection (implementing view types that have original container type
> erased) which won't make it this cycle. This new version for projection
> syntax rework is minor changes only comparde to v1, so I think it's worth
> sending out so it can still land this cycle and get out of the way.
Applied to `rust-next` -- thanks everyone!
[ Reworded docs slightly. - Miguel ]
[ Fixed broken intra-doc link. Added a few extra intra-doc links. Reworded
some docs slightly. - Miguel ]
Cheers,
Miguel
© 2016 - 2026 Red Hat, Inc.