Re: [PATCH v3 3/7] rust: auxiliary: add registration_data_with() for ForLt types

From: Alexandre Courbot

Date: Wed Jun 24 2026 - 10:38:33 EST


On Fri Jun 19, 2026 at 8:08 AM JST, Danilo Krummrich wrote:
> Add registration_data_with() taking a for<'a> closure that receives
> Pin<&'a F::Of<'a>>, which works with any ForLt type. Taking a for<'a>
> closure rather than returning a direct reference prevents callers from
> choosing a concrete lifetime for the data, which is required for
> soundness with non-covariant ForLt types.
>
> Extract the common null-check, TypeId-check and KBox-borrow logic into a
> private registration_data_pinned() helper shared by both
> registration_data_with() and the existing registration_data().
>
> Relax Registration's bound from CovariantForLt to ForLt so that
> non-covariant types can be registered.
>
> Signed-off-by: Danilo Krummrich <dakr@xxxxxxxxxx>

Sashiko's comment about missing `#[inlines]` is probably worth
consideration, but regardless:

Reviewed-by: Alexandre Courbot <acourbot@xxxxxxxxxx>