Use trybuild crate on the derive macros
Lokathor opened this issue · 2 comments
https://github.com/dtolnay/trybuild
This would let us declare things that should fail and then check that they really do fail.
Specifically, we could make a test such as
#[derive(Zeroable, Pod)]
pub struct Bad(u16, u8);
And that should fail to derive, of course.
I Implemented these tests over on my branch with one major hiccup. Trybuild checks the build output against the previous stderr to make sure everything failed for the same reasons. This means github actions will permanently fail on nightly builds as the output is different. There is an issue for this.
If you are to move forward with this: would you prefer to suppress checking the previous output or to copy in a separate set of stderr files in CI? Are there any other solutions?
It appears that, through a fluke of timing, they closed the trybuild issue as a "won't fix" after you posted this but before i saw your comment.
Let's just suppress the previous output check. The output doesn't really matter as long as the derive fails with some sort of error.