[PATCH 5/5] rust: ptr: remove implicit index projection syntax

Gary Guo
2026-04-15T19:58:14Z

All users have been converted to use keyworded index projection syntax to
explicitly state their intention when doing index projection.

Signed-off-by: Gary Guo <gary@garyguo.net>
---
rust/kernel/dma.rs | 6 ------
rust/kernel/ptr/projection.rs | 8 --------
2 files changed, 14 deletions(-)

diff --git a/rust/kernel/dma.rs b/rust/kernel/dma.rs
index d6382904a90d..642ccff465c8 100644
--- a/rust/kernel/dma.rs
+++ b/rust/kernel/dma.rs
@@ -1210,12 +1210,6 @@ macro_rules! dma_write {
(@parse [$dma:expr] [$($proj:tt)*] [[$flavor:ident: $index:expr] $($rest:tt)*]) => {
$crate::dma_write!(@parse [$dma] [$($proj)* [$flavor: $index]] [$($rest)*])
};
- (@parse [$dma:expr] [$($proj:tt)*] [[$index:expr]? $($rest:tt)*]) => {
- $crate::dma_write!(@parse [$dma] [$($proj)* [$index]?] [$($rest)*])
- };
- (@parse [$dma:expr] [$($proj:tt)*] [[$index:expr] $($rest:tt)*]) => {
- $crate::dma_write!(@parse [$dma] [$($proj)* [$index]] [$($rest)*])
- };
($dma:expr, $($rest:tt)*) => {
$crate::dma_write!(@parse [$dma] [] [$($rest)*])
};
diff --git a/rust/kernel/ptr/projection.rs b/rust/kernel/ptr/projection.rs
index 845811795393..fde565c836fc 100644
--- a/rust/kernel/ptr/projection.rs
+++ b/rust/kernel/ptr/projection.rs
@@ -346,14 +346,6 @@ macro_rules! project_pointer {
$crate::ptr::project!(@gen $ptr, $($rest)*)
};

- // For compatibility
- (@gen $ptr:ident, [$index:expr]? $($rest:tt)*) => {
- $crate::ptr::project!(@gen $ptr, [try: $index] $($rest)*)
- };
- (@gen $ptr:ident, [$index:expr] $($rest:tt)*) => {
- $crate::ptr::project!(@gen $ptr, [build: $index] $($rest)*)
- };
-
(mut $ptr:expr, $($proj:tt)*) => {{
let ptr: *mut _ = $ptr;
$crate::ptr::project!(@gen ptr, $($proj)*);

--
2.51.2