Re: [PATCH v2 1/7] rust: build_assert: add instructions for use with function arguments
From: John Hubbard
Date: Sun Nov 30 2025 - 23:36:47 EST
On 11/30/25 7:44 PM, Miguel Ojeda wrote:
On Mon, Dec 1, 2025 at 1:52 AM John Hubbard <jhubbard@xxxxxxxxxx> wrote:
More precisely, it was already *hinted* to be inline.
By inline I mean it is marked `#[inline]`, which may or may not get
inlined, but it also has other implications, e.g. codegen can get
delayed even if there are no callers and is concrete.
Then that is conceptually wrong, because it must be a runtime check.
No, it is not true it must be a runtime check -- it depends: you can
use such a function in some cases just fine.
That is the point of `build_assert!`, after all.
This seems strange: something called build_assert!() should not be
put in places where it might not be possible to verify at build-time.
It's built right into the name.
Sorry for the fussy detailed questioning here. I'm trying to bottom
out here because CLIPPY=1 is a very solid requirement before posting
patches.
No worries, but I don't follow what you mean here. `CLIPPY=1` is still
required to be clean etc.
CLIPPY=1 is effectively part of the developers' tool chain. It is also
one of the ways to break the build_assert!() call sites.
So now we have to go around and annotate the functions that *contain*
uses of build_assert!(). Otherwise we end up with an unreliable tool
chain for developers. This is not where we should want to be, in the
long run.
Is there proc macro magic we can come up with? Or rustc or clippy
changes? So that this is becomes a better foundation upon which to
build?
thanks,
--
John Hubbard