Pre-RFC: #[align] attribute

Ok, when it was phrased as "types" in the original post I thought it was still types in the rust sense.

Agreed that if it's just about the alignment of fields it's fine.

as i see it, the main utility of this sort of namespacing is preventing namespace pollution... which seems like it has dubious utility, i'm not sure what else #[align] could mean in this position exempt exactly this. i guess it's possible there's a proc macro out there that uses this already.

Well, it sort of is, because the ideal solution would be to have the ability to define a WgslVec3 type that will just do the right thing when used in a #[repr(C)] structure. But, as you pointed out, that would require breaking a fundamental Rust design choice.

Explicit field alignments like this are the next-best thing, but are still fundamentally a work-around for the impedance mismatch between the two languages.

2 Likes