-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Switch to manual trait impls for sigevent #1394
Conversation
r? @gnzlbg (rust_highfive has picked a reviewer for you, use r? to override) |
sigevent structs on most platforms have padding or unused fields. Rather than display those in the Debug impl by deriving it, manually implement all extra_traits instead ignoring those fields.
d61f529
to
7c26591
Compare
FWIW it might be that Looking at the type, does the function pointer field need to always be a non-null pointer ? If one can set that field to NULL in C, then this needs to be an Option in Rust, etc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from the NULL function pointer issue that @gnzlbg raised, this LGTM.
@gnzlbg Are you referring to the |
@bors: r+ |
📌 Commit 7c26591 has been approved by |
Switch to manual trait impls for sigevent `sigevent` on most platforms have padding or unused fields. Rather than display those in the `Debug` impl by deriving it, manually implement all `extra_traits` instead ignoring those fields. I do worry that my `PartialEq` implementations for this for some platforms (like Linux) is not correct due to ignoring bytes that shouldn't be ignored because these structs don't have a proper union set up. cc @asomers Part of nix-rust/nix#1035
Not only, in other platforms there are fields with type
Function pointers ( Another issue I am seeing is that these function pointers are not |
☀️ Test successful - checks-cirrus-freebsd-11, checks-cirrus-freebsd-12, checks-travis, status-appveyor |
sigevent
on most platforms have padding or unused fields. Ratherthan display those in the
Debug
impl by deriving it, manually implementall
extra_traits
instead ignoring those fields.I do worry that my
PartialEq
implementations for this for some platforms (like Linux) is not correct due to ignoring bytes that shouldn't be ignored because these structs don't have a proper union set up.cc @asomers
Part of nix-rust/nix#1035