mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Hubbard <jhubbard@nvidia.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: "Alexandre Courbot" <acourbot@nvidia.com>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Viresh Kumar" <viresh.kumar@linaro.org>,
	"Will Deacon" <will@kernel.org>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Mark Rutland" <mark.rutland@arm.com>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pm@vger.kernel.org,
	"Joel Fernandes" <joelagnelf@nvidia.com>
Subject: Re: [PATCH v2 1/7] rust: build_assert: add instructions for use with function arguments
Date: Mon, 1 Dec 2025 17:38:32 -0800	[thread overview]
Message-ID: <64d47186-d904-45c3-9471-9a06af4e94b5@nvidia.com> (raw)
In-Reply-To: <CANiq72kKsJz=SCjsTiPk=C=KWdJ_h2=A7AZsdEz_u0iemvuzJQ@mail.gmail.com>

On 12/1/25 3:06 PM, Miguel Ojeda wrote:
> On Mon, Dec 1, 2025 at 8:31 PM John Hubbard <jhubbard@nvidia.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


  reply	other threads:[~2025-12-02  1:38 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-28  2:11 [PATCH v2 0/7] rust: build_assert: document and fix " Alexandre Courbot
2025-11-28  2:11 ` [PATCH v2 1/7] rust: build_assert: add instructions for " Alexandre Courbot
2025-11-30 21:44   ` John Hubbard
2025-11-30 21:56     ` Miguel Ojeda
2025-11-30 22:00       ` John Hubbard
2025-11-30 22:42         ` Miguel Ojeda
2025-12-01  0:52           ` John Hubbard
2025-12-01  3:44             ` Miguel Ojeda
2025-12-01  4:36               ` John Hubbard
2025-12-01 16:43                 ` Miguel Ojeda
2025-12-01 19:31                   ` John Hubbard
2025-12-01 23:06                     ` Miguel Ojeda
2025-12-02  1:38                       ` John Hubbard [this message]
2025-12-01 19:53   ` Edwin Peer
2025-12-03  3:18     ` Alexandre Courbot
2025-11-28  2:11 ` [PATCH v2 2/7] rust: io: always inline functions using build_assert with arguments Alexandre Courbot
2025-12-01 20:06   ` Edwin Peer
2025-12-02 10:14     ` Alice Ryhl
2025-11-28  2:11 ` [PATCH v2 3/7] rust: cpufreq: " Alexandre Courbot
2025-11-28  6:12   ` Viresh Kumar
2025-11-28  9:32     ` Alice Ryhl
2025-11-28  9:55       ` Viresh Kumar
2025-11-28  2:11 ` [PATCH v2 4/7] rust: bits: " Alexandre Courbot
2025-11-28  2:11 ` [PATCH v2 5/7] rust: sync: refcount: " Alexandre Courbot
2025-11-28  2:11 ` [PATCH v2 6/7] rust: irq: " Alexandre Courbot
2025-11-28  2:11 ` [PATCH v2 7/7] rust: num: bounded: add missing comment for always inlined function Alexandre Courbot
2025-11-28 14:02 ` [PATCH v2 0/7] rust: build_assert: document and fix use with function arguments Daniel Almeida
2025-11-30 16:09 ` Daniel Almeida
2025-11-30 17:48   ` Miguel Ojeda
2025-12-03  3:19     ` Alexandre Courbot
2025-12-03 18:37       ` Miguel Ojeda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=64d47186-d904-45c3-9471-9a06af4e94b5@nvidia.com \
    --to=jhubbard@nvidia.com \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=gary@garyguo.net \
    --cc=joelagnelf@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=ojeda@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rafael@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    --cc=viresh.kumar@linaro.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®