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? > + /// 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? Thanks! Cheers, Miguel
