Re: [PATCH v3] rust: kernel: introduce `unsafe_precondition_assert!` macro

From: Miguel Ojeda
Date: Thu Jul 31 2025 - 07:43:12 EST


On Thu, Jul 31, 2025 at 1:12 PM Ritvik Gupta <ritvikfoss@xxxxxxxxx> wrote:
>
> +/// /// - `buf` must be non-null.
> +/// /// - `buf` must be 16-byte aligned.

We don't know since the full body is not shown, but it is likely this
would need to also be a valid pointer, i.e. it may be an uncommon
example.

Perhaps we could show one of the conditional cases, i.e. the "if `buf`
is non-null, then it must be valid." cases. That could also be a nice
excuse to also introduce an `implies()` function if an example allows
for it. But we can do that later on, no worries.

More importantly, could we have a user of the macro introduced in a
second patch so that it gets already used?

Thanks for the patch!

Cheers,
Miguel