Aligning an array constant

I have several pub const FOO: &'static [u16; 128]. I’d like to ensure that these are aligned to 64 bytes (cache lines). AFAICT, currently Rust guarantees an alignment of 2.

#[repr(align(64))] is not allowed for arrays. (Why?)

Is there a better way than wrapping each array in a struct that has #[repr(align(64))]?

I ended up wrapping all of them in a single struct.

1 Like