Re: [PATCH v2 1/7] rust: build_assert: add instructions for use with function arguments

From: John Hubbard

Date: Sun Nov 30 2025 - 17:01:11 EST


On 11/30/25 1:56 PM, Miguel Ojeda wrote:
On Sun, Nov 30, 2025 at 10:44 PM John Hubbard <jhubbard@xxxxxxxxxx> wrote:

Very interesting. So by adding a partially faulty build_assert!() call,
these functions were actually wrong when they created! Maybe a Fixes:
tag is warranted.

To clarify: it is the lack of optimization in certain configs (-Os,
CLIPPY=1...) as well as possibly certain code patterns that may
trigger it, not that the calls were faulty (note that `always` doesn't

It seems pretty clear that if one writes a *build* assertion about
a function argument, then that is just conceptually wrong unless it
is inlined. Because it can only really be a run-time assertion.

This is what Alex pointed out, and looking at the code I agree.

Thoughts?


guarantee it either anyway).

Yes, understood. So maybe "Fixes" is too strong. It's more like
"Mitigates:". :)


thanks,
--
John Hubbard


Daniel suggested Fixes in #0 -- if any of these trigger a build error
(like the `Bounded` one), then yeah. Cc: stable@ too.

Thanks!

Cheers,
Miguel