[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <64d47186-d904-45c3-9471-9a06af4e94b5@nvidia.com>
Date: Mon, 1 Dec 2025 17:38:32 -0800
From: John Hubbard <jhubbard@...dia.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@...il.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, Joel Fernandes <joelagnelf@...dia.com>
Subject: Re: [PATCH v2 1/7] rust: build_assert: add instructions for use with
function arguments
On 12/1/25 3:06 PM, Miguel Ojeda wrote:
> 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!
For the build_assert!() project, I didn't even get that far, because it
turns out that Joel Fernandes (+Cc) is already working hard on this.
>
> 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
thanks,
--
John Hubbard
Powered by blists - more mailing lists