Re: [PATCH v3 4/4] rust: make `build_assert` module the home of related macros
From: Miguel Ojeda
Date: Sat Mar 21 2026 - 09:44:26 EST
On Sat, Mar 21, 2026 at 2:32 PM Gary Guo <gary@xxxxxxxxxxx> wrote:
>
> I personally view them all as variants of BUILD_BUG_ON, hence the name is
> `build_assert`. I thought about `assert`, but to me that feels like it's going
> to host runtime assertions.
>
> I won't be surprised if we're going to have `assert` module in the future to
> host families of
>
> assert!()
> warn_on!()
> unsafe { assume!() }
> ensure!()
>
> etc..
We also have now `unsafe_precondition_assert` in the `safety` module
which is essentially a `debug_assert` at least for now, which could
potentially be moved too.
Most of these (both build time and runtime ones) should be in the
prelude anyway, so they should be easy to reorganize.
Cheers,
Miguel