Re: [PATCH v3 5/5] rust: Add KUNIT tests for bitfield

From: Miguel Ojeda

Date: Sun Sep 21 2025 - 07:42:09 EST


On Sat, Sep 20, 2025 at 2:39 AM Joel Fernandes <joelagnelf@xxxxxxxxxx> wrote:
>
> The C checks use BUILD_BUG_ON, in rust-for-linux we have build_assert but it
> is fragile and depends on the value being a constant.

What do you mean?

`build_assert!` works essentially like `BUILD_BUG_ON`, i.e. after the
optimizer, and does not depend on the value being a constant.

You may be thinking of `static_assert!`, which is the compiler-based one.

Cheers,
Miguel