Why is rust allowed to reorder fields? If I know that fields are going to be generally accessed together, this prevents me from ordering them so they fit in cache lines.
It's allowed as an optimization, the order it uses will limit the space lost to field alignment.
You can tell it not to reorder them if you want but it's not the default.
It's allowed as an optimization, the order it uses will limit the space lost to field alignment.