From: "Alexandre Courbot" <acourbot@nvidia.com>
To: "Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com>
Cc: "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" <benno.lossin@proton.me>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
"Fiona Behrens" <me@kloenk.dev>
Subject: Re: [PATCH v5] rust: kernel: add support for bits/genmask macros
Date: Thu, 22 May 2025 17:23:31 +0900 [thread overview]
Message-ID: <DA2JMEL971SA.3J61636AYG6E9@nvidia.com> (raw)
In-Reply-To: <CANiq72ny+uSZ8wNyqozTUNma1tKfS4du0yd4+nTjioYmyw25CQ@mail.gmail.com>
On Thu May 22, 2025 at 5:21 PM JST, Miguel Ojeda wrote:
> On Thu, May 22, 2025 at 5:17 AM Alexandre Courbot <acourbot@nvidia.com> wrote:
>>
>> // Compile-time error if `n` is out of bounds.
>> pub const fn bit_u32(n: u32) -> u32 {
>> // Only accept values known at compile-time.
>> static_assert!(n < u32::BITS);
>> 1u32 << n
>> }
>
> I think this was meant to be `build_assert!`. `static_assert!` cannot
> be used when the value is potentially not known.
Indeed, thanks for correcting!
>
> (It would need to be `#[inline]` too).
Like everything else in this module. :)
next prev parent reply other threads:[~2025-05-22 8:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-26 14:06 [PATCH v5] rust: kernel: add support for bits/genmask macros Daniel Almeida
2025-03-27 21:27 ` Miguel Ojeda
2025-05-13 18:52 ` Daniel Almeida
2025-05-19 17:57 ` Miguel Ojeda
2025-05-22 5:01 ` Alexandre Courbot
2025-05-21 7:53 ` Alexandre Courbot
2025-05-22 3:17 ` Alexandre Courbot
2025-05-22 8:21 ` Miguel Ojeda
2025-05-22 8:23 ` Alexandre Courbot [this message]
2025-05-22 8: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=DA2JMEL971SA.3J61636AYG6E9@nvidia.com \
--to=acourbot@nvidia.com \
--cc=a.hindborg@kernel.org \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=me@kloenk.dev \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.