[PATCH v2 3/4] rust: io: Implement Copy for RegisterArrayLoc

From: Markus Probst

Date: Fri Dec 04 2026 - 07:22:38 EST


This allows storing `RegisterArrayLoc` and using it multiple times.

Derive is not possible, as it would introduce the unnecessary `T: Copy`
bound.

Signed-off-by: Markus Probst <markus.probst@xxxxxxxxx>
---
rust/kernel/io/register.rs | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/rust/kernel/io/register.rs b/rust/kernel/io/register.rs
index c4f7be770dcb..6381c52bd397 100644
--- a/rust/kernel/io/register.rs
+++ b/rust/kernel/io/register.rs
@@ -209,6 +209,14 @@ fn offset(self) -> usize {
}
}

+impl<T: RegisterArray> Copy for RegisterArrayLoc<T> {}
+
+impl<T: RegisterArray> Clone for RegisterArrayLoc<T> {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+
/// Trait providing location builders for [`RegisterArray`]s.
pub trait Array {
/// Returns the location of the register at position `idx`, with build-time validation.

--
2.56.1