-
-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
derive(Pod)
should work for repr(c)
structs with generics fields where all fields have the same type
#75
Comments
This seems accurate, if the generic is also Pod of course. Edit: I would accept a PR for this but I am unlikely to do it myself because I'm not that big on proc-macros. |
I have a patch for this: main...LukasKalbertodt:relax-derives-for-generics The reason why I did not submit this as PR (yet) is because it makes a specific error messages notably worse: if a field's type does not implement
With this change, the error is:
This is basically due to this: rust-lang/rust#90869 (I just reported this issue). So, how to proceed?
|
Option B seems fine if the error message is fixed in a timely manner, which is usually the case (thank you ekuber and co <3). If the issue lingers we can go with Option A if we have to. Since this doesn't actually block Pod from being implemented manually then it's probably fine to wait a little longer. |
Hui, it was indeed fixed very quickly. Those people are amazing! I will soon submit my changes as PR. Whenever I get to it. I guess it's fine to still wait a bit, maybe until the fix is on stable or so. |
Nice work! A further relaxation might be type-layout, there is this note, however I don't see how it applies to
Since it seems relatively related, I thought I might mention it here, but should open up a different issue unless I'm missing something. |
According to this definition of
repr(C)
in Rust, structs where all fields have the same type are laid out like arrays (no padding anywhere). The reference doesn't directly state this, but it follows from the given layout algorithm (unless I'm wrong).The text was updated successfully, but these errors were encountered: