[PATCH v5 02/12] rust: xarray: add debug format for `StoreError`

From: Andreas Hindborg

Date: Wed Sep 02 2026 - 09:39:47 EST


Add a `Debug` implementation for `StoreError<T>` to enable better error
reporting and debugging. The implementation only displays the `error`
field and omits the `value` field, as `T` may not implement `Debug`.

Reviewed-by: Gary Guo <gary@xxxxxxxxxxx>
Reviewed-by: Daniel Gomez <da.gomez@xxxxxxxxxxx>
Acked-by: Tamir Duberstein <tamird@xxxxxxxxx>
Acked-by: Liam R. Howlett <Liam.Howlett@xxxxxxxxxx>
Reviewed-by: Daniel Almeida <daniel.almeida@xxxxxxxxxxxxx>
Assisted-by: LLM
Signed-off-by: Andreas Hindborg <a.hindborg@xxxxxxxxxx>
---
rust/kernel/xarray.rs | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/rust/kernel/xarray.rs b/rust/kernel/xarray.rs
index 02f93ae1f92d..4335caab8cca 100644
--- a/rust/kernel/xarray.rs
+++ b/rust/kernel/xarray.rs
@@ -19,6 +19,7 @@
Result, //
},
ffi::c_void,
+ fmt,
types::{
ForeignOwnable,
NotThreadSafe,
@@ -193,6 +194,14 @@ pub struct StoreError<T> {
pub value: T,
}

+impl<T> fmt::Debug for StoreError<T> {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ f.debug_struct("StoreError")
+ .field("error", &self.error)
+ .finish()
+ }
+}
+
impl<T> From<StoreError<T>> for Error {
#[inline]
fn from(value: StoreError<T>) -> Self {

--
2.51.2