[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DCO2UHSV1FJH.146QJD3UR8FVR@nvidia.com>
Date: Tue, 09 Sep 2025 16:05:22 +0900
From: "Alexandre Courbot" <acourbot@...dia.com>
To: "Miguel Ojeda" <miguel.ojeda.sandonis@...il.com>
Cc: "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>, "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>,
<nouveau@...ts.freedesktop.org>
Subject: Re: [PATCH v5 1/2] rust: add `Alignment` type
Hi Miguel,
On Mon Sep 8, 2025 at 11:21 PM JST, Miguel Ojeda wrote:
> On Mon, Sep 8, 2025 at 3:26 PM Alexandre Courbot <acourbot@...dia.com> wrote:
>>
>> + if ALIGN.is_power_of_two() {
>> + // INVARIANT: `align` is a power of two.
>> + // SAFETY: `align` is a power of two, and thus non-zero.
>> + Self(unsafe { NonZero::new_unchecked(ALIGN) })
>> + } else {
>> + build_error!("Provided alignment is not a power of two.");
>> + }
>
> Would `build_assert!` at the top work instead?
Oops, it certainly would.
>
>> + /// Returns this alignment as a `usize`.
>
> Intra-doc link.
>
>> + // SAFETY: per the invariants, `self.0` is always a power of two so this block will
>
> "Per".
>
> I can pick this, with or without the user -- or do you need this in
> Nova this cycle?
With -rc6 approaching, I don't think we will merge any Nova code taking
advantage of this for this cycle, so please feel free to take this
patch. We can then merge patch 2 through drm-rust after -rc1 is
released.
Should I send a new revision with your fixes, or will you apply them?
Powered by blists - more mailing lists