All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alexandre Courbot" <acourbot@nvidia.com>
To: "Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com>
Cc: "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>,
	"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,
	nouveau@lists.freedesktop.org
Subject: Re: [PATCH v5 1/2] rust: add `Alignment` type
Date: Tue, 09 Sep 2025 16:05:22 +0900	[thread overview]
Message-ID: <DCO2UHSV1FJH.146QJD3UR8FVR@nvidia.com> (raw)
In-Reply-To: <CANiq72kUsG10+E-W6zhFXhexZV+O_a-K1Px0kGkWPKvMMhAztQ@mail.gmail.com>

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@nvidia.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?

  reply	other threads:[~2025-09-09  7:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-08 13:25 [PATCH v5 0/2] rust: add `Alignment` type Alexandre Courbot
2025-09-08 13:25 ` [PATCH v5 1/2] " Alexandre Courbot
2025-09-08 14:21   ` Miguel Ojeda
2025-09-09  7:05     ` Alexandre Courbot [this message]
2025-09-09  7:21       ` Miguel Ojeda
2025-09-09  8:01         ` Alexandre Courbot
2025-09-09  9:14         ` Danilo Krummrich
2025-09-08 13:25 ` [PATCH v5 2/2] gpu: nova-core: use Alignment for alignment-related operations Alexandre Courbot
2025-09-08 13:56   ` Danilo Krummrich
2025-09-09 22:04 ` [PATCH v5 0/2] rust: add `Alignment` type Miguel Ojeda
2025-09-10  1:13   ` Alexandre Courbot
2025-09-22 21:59 ` 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=DCO2UHSV1FJH.146QJD3UR8FVR@nvidia.com \
    --to=acourbot@nvidia.com \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=nouveau@lists.freedesktop.org \
    --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.