[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANiq72kKsJz=SCjsTiPk=C=KWdJ_h2=A7AZsdEz_u0iemvuzJQ@mail.gmail.com>
Date: Tue, 2 Dec 2025 00:06:25 +0100
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: John Hubbard <jhubbard@...dia.com>
Cc: Alexandre Courbot <acourbot@...dia.com>, Danilo Krummrich <dakr@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Daniel Almeida <daniel.almeida@...labora.com>,
Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <lossin@...nel.org>, Andreas Hindborg <a.hindborg@...nel.org>,
Trevor Gross <tmgross@...ch.edu>, "Rafael J. Wysocki" <rafael@...nel.org>,
Viresh Kumar <viresh.kumar@...aro.org>, Will Deacon <will@...nel.org>,
Peter Zijlstra <peterz@...radead.org>, Mark Rutland <mark.rutland@....com>,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-pm@...r.kernel.org
Subject: Re: [PATCH v2 1/7] rust: build_assert: add instructions for use with
function arguments
On Mon, Dec 1, 2025 at 8:31 PM John Hubbard <jhubbard@...dia.com> wrote:
>
> Mainly just: is there a way to automatically "derive" (generate) an
> always-inline directive for any function that attempts to call
> build_assert!() on any of its arguments? And in fact, *force* the
> always-inline, if it is not forced hard enough today.
>
> Something along those lines.
"Wide-scoped" macros can do passes like that, i.e. like some projects
do to add extra syntax everywhere. Not sure we want to get into that
world, though.
Instead, if we are just talking about checking, then I think we could
have an attribute macro to mark such functions, and then
`build_assert!` could fail "by default" unless inside one of those,
and it would get rewritten into the proper form by the macro, so any
call without it would fail. It is always nice to mark special
functions anyway, just like our `export` one.
Otherwise, for more than just checking, I guess a custom tool like
Klint could also do it for us (I am sure Gary has ideas here).
> I will bring this up (along with the KSYM_NAME_LEN hashed symbol project)
> to our internal Rust groups. Both of these seem like nice, self-contained
> projects that someone could really get into.
That is great -- thanks!
On related news, Antoni (Cc'd) told me yesterday that he noticed
`inline(always)` was needed when using the GCC backend too, so this
series will help him too.
Cheers,
Miguel
Powered by blists - more mailing lists