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 <[email protected]> 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?
