Skip to content

Rewrite and Fix Remaining Padding Bugs#35

Merged
LPGhatguy merged 16 commits intomainfrom
rewrite-tests-fix-padding
Oct 17, 2021
Merged

Rewrite and Fix Remaining Padding Bugs#35
LPGhatguy merged 16 commits intomainfrom
rewrite-tests-fix-padding

Conversation

@LPGhatguy
Copy link
Copy Markdown
Owner

@LPGhatguy LPGhatguy commented Oct 13, 2021

Closes #29.

It's been awhile since I've dug into this problem. In this PR, I rewrote Crevice almost completely to fix all the remaining layout bugs and tighten up the test suite to be much more effective.

I think that some of our snapshot tests ended up incorrect for whatever reason, so I've replaced them with a macro that generates offset_of! assertions. I think this will be much more clear and encourage test authors to read through the spec and reason about results instead of committing snapshots as-is.

Generated structs now have padding after each field instead of before. This lets us pad at the end of structs consistently. As part of that refactor, I improved the clarity of the derive macro code dramatically. It should be a lot easier to follow.

Also done during this PR is tightening of names with the crate's traits. The associated type on AsStd{140,430} is now called Output. I may rename these traits to IntoStd{140,430} to make them less semantically awkward, and then propagate that through all the method names.

All in all, this implementation has little in common with the old one and hopefully has fewer bugs.

@LPGhatguy LPGhatguy changed the title Rewrite Tests and Fix Remaining Padding Bugs Rewrite and Fix Remaining Padding Bugs Oct 17, 2021
@LPGhatguy LPGhatguy marked this pull request as ready for review October 17, 2021 06:32
@LPGhatguy
Copy link
Copy Markdown
Owner Author

Success! I found three bugs in Naga doing this:

@LPGhatguy
Copy link
Copy Markdown
Owner Author

Looking good, time to merge and move onto the next round of work.

@LPGhatguy LPGhatguy merged commit 8ddab3e into main Oct 17, 2021
@LPGhatguy LPGhatguy deleted the rewrite-tests-fix-padding branch October 17, 2021 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Round Up Size of All Structures to Structure Alignment

1 participant