Re: [PATCH] rust: add `CacheAligned` for easy cache line alignment of values

From: Miguel Ojeda

Date: Wed Jan 28 2026 - 09:47:38 EST


On Wed, Jan 28, 2026 at 3:41 PM Gary Guo <gary@xxxxxxxxxxx> wrote:
>
> Unfortunately `repr(align())` does not accept expression or macro invocations.
> It's still possible with code-generation, but it'll be more tricky.
>
> On all archs that we do support today, I think the value is always 64. However
> it'd worth putting a FIXME or TODO (or assertion, maybe?) in case new archs gets
> addded where this isn't true.

The docs need to also avoid mentioning 64 themselves; otherwise,
someone may use this and rely on it being 64, i.e. not just cache
aligned, but actually 64.

If Andreas really wants a fixed 64 one, then perhaps we want several
types like `Aligned64` etc.

Cheers,
Miguel