Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Low] rust: dma_fence: unstable assert_matches in doctest breaks KUnit build
--

commit 1a1a7bd301271b4681c7504f6e6f60ca7abd6bb7
Author: Philipp Stanner <[email protected]>

rust: DmaFence: Replace is_signaled() with status()

This commit replaces Fence::is_signaled() with Fence::status() returning a
FenceStatus enum so callers must check whether a signaled fence completed with
an error while holding the fence lock.

> diff --git a/rust/kernel/dma_buf/dma_fence.rs 
> b/rust/kernel/dma_buf/dma_fence.rs
> index fbbc6ab202eca..9cef604f17ea9 100644
> --- a/rust/kernel/dma_buf/dma_fence.rs
> +++ b/rust/kernel/dma_buf/dma_fence.rs

[ ... ]

> @@ -650,11 +658,15 @@ struct DriverFenceData<'a, T: Send + Sync + 
> FenceContextOps> {
>  ///         FenceContextOps,
>  ///         FenceCallback,
>  ///         FenceCallbackRegistration,
> +///         FenceStatus, //
>  ///     },
>  ///     str::CString,
>  ///     sync::aref::ARef, //
>  /// };
> -/// use core::fmt::Display;
> +/// use core::{
> +///     assert_matches,
> +///     fmt::Display, //
> +/// };
>  ///
>  /// struct CallbackData { }
>  ///
> @@ -700,9 +712,9 @@ struct DriverFenceData<'a, T: Send + Sync + 
> FenceContextOps> {
>  /// let cb_reg = KBox::pin_init(cb_reg, GFP_KERNEL)?;
>  ///
>  /// // TODO signalling guards
> -/// assert_eq!(waiting_fence.is_signaled(), false);
> +/// assert_matches!(waiting_fence.status(), FenceStatus::Unsignaled);
>  /// fence.signal(Ok(()));
> -/// assert_eq!(waiting_fence.is_signaled(), true);
> +/// assert_matches!(waiting_fence.status(), FenceStatus::Signaled(Ok(())));

[Severity: Low]
Does using core::assert_matches in the DriverFence doctest break the build when
CONFIG_RUST_KERNEL_DOCTESTS=y and CONFIG_DMA_SHARED_BUFFER=y are enabled?

When CONFIG_RUST_KERNEL_DOCTESTS=y is set, scripts/rustdoc_test_gen extracts
this doctest into rust/doctests_kernel_generated.rs, which is compiled using
rust_common_cmd in scripts/Makefile.build:

    rust_allowed_features := 
arbitrary_self_types,asm_goto,generic_arg_infer,used_with_arg

Because assert_matches is an unstable library feature in core that is not in
rust_allowed_features and feature(assert_matches) is not enabled for the
doctest crate, compiling rust/doctests_kernel_generated.o fails with
error[E0658].

Would it work to use assert!(matches!(...)) instead, or derive PartialEq and Eq
on FenceStatus so assert_eq! can be used with the KUnit doctest assertion
macros?

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=5

Reply via email to