Re: [PATCH] rust: add `assert_sync` function

From: Miguel Ojeda
Date: Sat Jun 07 2025 - 13:30:40 EST


On Sat, Jun 7, 2025 at 5:54 PM Christian Schrefl
<chrisi.schrefl@xxxxxxxxx> wrote:
>
> Should I already add this in V2 for this series?

I would do that in a separate patch (possibly in this series, or later on).

> I've tried it with `compile_fail` and it didn't work, I think
> that's not supported in (kernel) doc tests yet.

Yeah, it isn't -- please leave a normal comment to indicate it, so
that we can replace it with the real annotation in the future.

> That might make sense, with macros we would not need to write
> a const block to ensure its not executed at runtime (although
> it's probably optimized out anyways). It would also mean that

There is nothing to execute, no? It is `#[inline(always)]`, and even
if that wasn't enough, we always build with optimizations enabled.

But yeah, if needed, we may want to have macro(s) like that.

Thanks!

Cheers,
Miguel