Re: [PATCH 2/2] rust: add `const_assert!` macro
From: Miguel Ojeda
Date: Fri Feb 13 2026 - 05:26:39 EST
On Fri, Feb 13, 2026 at 10:07 AM Gary Guo <gary@xxxxxxxxxxx> wrote:
>
> The reason that I want to omit "link-time" is that our `build_assert!()` *can*
> still be checked before link-time. Again with example above, user can write
>
> static_assert!(foo(0) == 0);
>
> which means that now `foo` is evaluated by the compiler. When this happens,
> `build_assert!()` also abort the build during compilation time, not link-time.
Another reason would be that, ideally/eventually, Rust could perhaps
provide something like GCC/Clang `error`/`warning` attributes, and
thus it could fail earlier like the C side one (perhaps still at the
end of LLVM, but not as late as linking).
Cheers,
Miguel