Marker has a few tests, that check the size of structs. @Veetaha suggested to potentially use snapshot-testing to allow automatic updates of these tests:
I recommend you to use a snapshot-testing library.
I've been using expect-test, which is a suprisingly low-overhead crate for snapshot testing.
This way you can capture all the data about the types and their sizes in a string snapshot (inline our out-of-line in a separate file) and re-generate it if something changes with UPDATE_EXPECT=1 cargo test, which means maintaining tests becomes almost a zero-effort task, because they rewrite themselves, and you just review the diff.
This testing library was originally developed for use in rust-analyzer by @matklad and I've been using it in production successfuly so far. The one thing is that the library is barebones, and requires some small amount of batteries (like I added in my repo here) to make JSON snapshots and auto-format snapshots such that they don't exceed 80 lines in the editor
Marker has a few tests, that check the size of structs.
@Veetaha
suggested to potentially use snapshot-testing to allow automatic updates of these tests: