bytemuck
bytemuck copied to clipboard
Make `AnyBitPattern` derive work for generic structs
(Note: despite the similar titles, this PR is not related to #83 at all. This PR is specific to the changes introduced in #91.)
When using AnyBitPattern
derive, an automatic derive for Zeroable
is created as well. However, the latter derive is missing generic parameters for the struct, which means you get errors like the following:
error[E0107]: missing generics for struct `AnyBitPatternTest`
--> tests/basic.rs:107:8
|
107 | struct AnyBitPatternTest<A: AnyBitPattern, B: AnyBitPattern> {
| ^^^^^^^^^^^^^^^^^ expected 2 generic arguments
|
note: struct defined here, with 2 generic parameters: `A`, `B`
--> tests/basic.rs:107:8
|
107 | struct AnyBitPatternTest<A: AnyBitPattern, B: AnyBitPattern> {
| ^^^^^^^^^^^^^^^^^ - -
help: add missing generic arguments
|
107 | struct AnyBitPatternTest<A, B><A: AnyBitPattern, B: AnyBitPattern> {
| ~~~~~~~~~~~~~~~~~~~~~~~
The help text is worse than useless, because the suggested fix makes things worse.
@fu5ha you get to review this one!
Not sure why this is failing on nightly tho
Wonder if it's using the old macro expansion? Certainly the error message suggests so. Didn't you run into similar CI bogosity in #91?
Just so I know I haven't gone nuts, here's the nightly and miri runs on my computer: https://gist.github.com/cky/f80cc8b82632bd10deaebcb1a5668172
Is there a way to rerun the CI? I could technically push an empty commit just to trigger one but if there's a way to actually just rerun, I'd rather not junk up the branch with empty commits. ;-)
I'll try a close and re-open.
@cky sorry I haven't looked at this one in ages. It seems by now there's a small conflict in a test file. Do you want to fix that up and then I think we can merge this?