Re: [PATCH v2 01/15] rust: pin-init: remove `try_` versions of the initializer macros
From: Gary Guo
Date: Mon Jan 12 2026 - 07:57:21 EST
On Sun Jan 11, 2026 at 12:24 PM GMT, Benno Lossin wrote:
> The `try_[pin_]init!` versions of the initializer macros are
> superfluous. Instead of forcing the user to always write an error in
> `try_[pin_]init!` and not allowing one in `[pin_]init!`, combine them
> into `[pin_]init!` that defaults the error to
> `core::convert::Infallible`, but also allows to specify a custom one.
>
> Projects using pin-init still can provide their own defaulting
> initializers using the `try_` prefix by using the `#[default_error]`
> attribute added in a future patch.
>
> [ Adjust the definition of the kernel's version of the `try_`
> initializer macros - Benno]
>
> Signed-off-by: Benno Lossin <lossin@xxxxxxxxxx>
Reviewed-by: Gary Guo <gary@xxxxxxxxxxx>
> ---
> Changes in v2: none
> ---
> rust/kernel/init.rs | 8 +-
> rust/pin-init/README.md | 2 +-
> rust/pin-init/examples/linked_list.rs | 19 ++--
> rust/pin-init/examples/pthread_mutex.rs | 10 +-
> rust/pin-init/src/lib.rs | 118 ++++--------------------
> 5 files changed, 35 insertions(+), 122 deletions(-)