[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DA2JMEL971SA.3J61636AYG6E9@nvidia.com>
Date: Thu, 22 May 2025 17:23:31 +0900
From: "Alexandre Courbot" <acourbot@...dia.com>
To: "Miguel Ojeda" <miguel.ojeda.sandonis@...il.com>
Cc: "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"
<benno.lossin@...ton.me>, "Andreas Hindborg" <a.hindborg@...nel.org>,
"Alice Ryhl" <aliceryhl@...gle.com>, "Trevor Gross" <tmgross@...ch.edu>,
"Danilo Krummrich" <dakr@...nel.org>, <linux-kernel@...r.kernel.org>,
<rust-for-linux@...r.kernel.org>, "Fiona Behrens" <me@...enk.dev>
Subject: Re: [PATCH v5] rust: kernel: add support for bits/genmask macros
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@...dia.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. :)
Powered by blists - more mailing lists