-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Tracking issue for RFC 2235, "Implement Debug, Eq, PartialEq, and Hash for libc structs" #57715
Comments
A problem that came up when implementing this is for implementing impl std::hash::Hash for fpreg_t {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.d.to_bits().hash(state);
}
} We should decide if we want to handle this: avoid it entirely for types that have floats or doubles, implement them like I did above, or sort out a "better" way to deal with hashing them. |
RFC 2235 - Implement PartialEq,Eq,Hash,Debug for all types First pass at implementing [RFC2235](https://github.com/rust-lang/rfcs/blob/master/text/2235-libc-struct-traits.md). I just started with `PartialEq`/`Eq` and tested locally on my x64 Linux system. Definitely going to run into other types for other platforms that need this treatment, but thought I'd start small. Open question is whether this should also rely on the `align` feature, which should improve which types can be auto-derived versus manually implemented (as it removed a lot of odd-sized padding arrays). My first pass here doesn't do that, but I might test it out to see if it does simplify quite a few structs. I think it might also be nice to have as it makes it easier for contributors to add new structs. Part of rust-lang/rust#57715
Many types still don't implement all of the traits, e.g., grep on
|
Implement more extra_traits Finishing the implementation of rust-lang/rust#57715 now that all platforms are tested in CI. I plan to expand this CI to all platforms that need this treatment (solarish, empscripten, freebsd, and netbsd), but thought I'd get the part I've already started running in CI since I can't test this changes locally.
@Susurrus is this fully implemented now? rust-lang/libc#1271 seems to indicate so. |
It’s mostly implemented, but there is still the unresolved questions about
enforcing requiring this and also about whether to enable this by default.
…On Sun 9. Jun 2019 at 15:42, Jonas Schievink ***@***.***> wrote:
@Susurrus <https://github.com/Susurrus> is this fully implemented now?
rust-lang/libc#1271 <rust-lang/libc#1271> seems
to indicate so.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#57715?email_source=notifications&email_token=AAG43JSNSPUYYNUXYYFKMRDPZUCDVA5CNFSM4GQ3LWSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXIKMQA#issuecomment-500213312>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAG43JXM6TBSJ2TRE3DL7UDPZUCDVANCNFSM4GQ3LWSA>
.
|
This is mostly implemented, and to the extent it isn't, it's a libc issue rather than a rust-lang/rust issue. Closing; please feel free to open an issue on libc for any remaining aspects of it. |
This is a tracking issue for the RFC "Implement Debug, Eq, PartialEq, and Hash for libc structs" (rust-lang/rfcs#2235).
Steps:
Unresolved questions:
#[derive(Debug, Eq, Hash, PartialEq)]
since theCopy
andClone
traits are directly implemented and not derived?The text was updated successfully, but these errors were encountered: