From 9a4590190f9e86266e2562ad120e20790a6a505e Mon Sep 17 00:00:00 2001 From: Ryan Johnson Date: Fri, 10 May 2024 11:39:01 +0000 Subject: [PATCH 1/3] Remove extra traits --- Cargo.toml | 3 +- README.md | 3 - ci/build.sh | 20 - ci/run.sh | 4 +- ci/style.rs | 3 - libc-test/Cargo.toml | 1 - src/fuchsia/align.rs | 72 - src/fuchsia/mod.rs | 335 ---- src/fuchsia/x86_64.rs | 44 - src/lib.rs | 1 - src/macros.rs | 26 - src/solid/mod.rs | 2 - src/unix/aix/mod.rs | 122 -- src/unix/aix/powerpc64.rs | 296 ---- src/unix/bsd/apple/b32/align.rs | 3 +- src/unix/bsd/apple/b32/mod.rs | 31 - src/unix/bsd/apple/b64/aarch64/align.rs | 5 +- src/unix/bsd/apple/b64/align.rs | 3 +- src/unix/bsd/apple/b64/mod.rs | 31 - src/unix/bsd/apple/b64/x86_64/align.rs | 3 +- src/unix/bsd/apple/mod.rs | 1527 +---------------- src/unix/bsd/freebsdlike/dragonfly/mod.rs | 371 ---- src/unix/bsd/freebsdlike/freebsd/aarch64.rs | 100 +- .../bsd/freebsdlike/freebsd/freebsd11/b64.rs | 1 - .../bsd/freebsdlike/freebsd/freebsd11/mod.rs | 169 -- .../bsd/freebsdlike/freebsd/freebsd12/b64.rs | 1 - .../bsd/freebsdlike/freebsd/freebsd12/mod.rs | 173 -- .../bsd/freebsdlike/freebsd/freebsd13/b64.rs | 1 - .../bsd/freebsdlike/freebsd/freebsd13/mod.rs | 173 -- .../bsd/freebsdlike/freebsd/freebsd14/b64.rs | 1 - .../bsd/freebsdlike/freebsd/freebsd14/mod.rs | 173 -- .../bsd/freebsdlike/freebsd/freebsd15/b64.rs | 1 - .../bsd/freebsdlike/freebsd/freebsd15/mod.rs | 173 -- src/unix/bsd/freebsdlike/freebsd/mod.rs | 920 ---------- src/unix/bsd/freebsdlike/freebsd/riscv64.rs | 106 +- src/unix/bsd/freebsdlike/freebsd/x86.rs | 114 +- .../bsd/freebsdlike/freebsd/x86_64/align.rs | 140 +- .../bsd/freebsdlike/freebsd/x86_64/mod.rs | 173 -- src/unix/bsd/freebsdlike/mod.rs | 42 - src/unix/bsd/mod.rs | 92 - src/unix/bsd/netbsdlike/mod.rs | 2 - src/unix/bsd/netbsdlike/netbsd/aarch64.rs | 43 - src/unix/bsd/netbsdlike/netbsd/mod.rs | 492 ------ src/unix/bsd/netbsdlike/openbsd/mod.rs | 441 +---- src/unix/bsd/netbsdlike/openbsd/x86_64.rs | 54 - src/unix/haiku/mod.rs | 187 +- src/unix/haiku/native.rs | 75 - src/unix/haiku/x86_64.rs | 210 +-- src/unix/hurd/mod.rs | 65 - src/unix/linux_like/android/b32/arm.rs | 90 - src/unix/linux_like/android/b32/mod.rs | 14 - src/unix/linux_like/android/b32/x86/align.rs | 3 +- src/unix/linux_like/android/b32/x86/mod.rs | 87 - .../linux_like/android/b64/aarch64/align.rs | 5 +- src/unix/linux_like/android/b64/mod.rs | 113 -- .../linux_like/android/b64/riscv64/align.rs | 3 +- .../linux_like/android/b64/x86_64/align.rs | 3 +- src/unix/linux_like/android/b64/x86_64/mod.rs | 221 --- src/unix/linux_like/android/mod.rs | 414 ----- src/unix/linux_like/emscripten/align.rs | 31 - src/unix/linux_like/emscripten/mod.rs | 132 -- src/unix/linux_like/linux/align.rs | 5 - .../linux_like/linux/gnu/b32/arm/align.rs | 39 +- .../linux_like/linux/gnu/b32/csky/align.rs | 3 +- .../linux_like/linux/gnu/b32/m68k/align.rs | 3 +- .../linux_like/linux/gnu/b32/mips/align.rs | 3 +- .../linux_like/linux/gnu/b32/riscv32/align.rs | 8 +- .../linux_like/linux/gnu/b32/sparc/align.rs | 3 +- .../linux_like/linux/gnu/b32/x86/align.rs | 3 +- src/unix/linux_like/linux/gnu/b32/x86/mod.rs | 102 -- .../linux_like/linux/gnu/b64/aarch64/align.rs | 5 +- .../linux/gnu/b64/loongarch64/align.rs | 5 +- .../linux_like/linux/gnu/b64/mips64/align.rs | 3 +- .../linux/gnu/b64/powerpc64/align.rs | 3 +- .../linux_like/linux/gnu/b64/riscv64/align.rs | 8 +- src/unix/linux_like/linux/gnu/b64/s390x.rs | 29 - .../linux_like/linux/gnu/b64/sparc64/align.rs | 3 +- .../linux_like/linux/gnu/b64/x86_64/align.rs | 5 +- .../linux_like/linux/gnu/b64/x86_64/mod.rs | 97 -- src/unix/linux_like/linux/gnu/mod.rs | 176 +- src/unix/linux_like/linux/mod.rs | 528 +----- .../linux_like/linux/musl/b32/arm/align.rs | 3 +- src/unix/linux_like/linux/musl/b32/arm/mod.rs | 38 - .../linux_like/linux/musl/b32/mips/align.rs | 3 +- .../linux/musl/b32/riscv32/align.rs | 3 +- .../linux_like/linux/musl/b32/x86/align.rs | 3 +- src/unix/linux_like/linux/musl/b32/x86/mod.rs | 105 -- .../linux/musl/b64/aarch64/align.rs | 5 +- .../linux/musl/b64/loongarch64/align.rs | 5 +- .../linux/musl/b64/riscv64/align.rs | 8 +- src/unix/linux_like/linux/musl/b64/s390x.rs | 29 - .../linux_like/linux/musl/b64/x86_64/align.rs | 6 +- .../linux_like/linux/musl/b64/x86_64/mod.rs | 101 -- src/unix/linux_like/linux/musl/mod.rs | 133 -- .../linux_like/linux/uclibc/x86_64/l4re.rs | 1 - .../linux_like/linux/uclibc/x86_64/mod.rs | 3 - src/unix/linux_like/mod.rs | 179 -- src/unix/mod.rs | 3 - src/unix/nto/mod.rs | 397 ----- src/unix/nto/neutrino.rs | 3 - src/unix/nto/x86_64.rs | 40 - src/unix/redox/mod.rs | 168 +- src/unix/solarish/mod.rs | 422 ----- src/unix/solarish/solaris.rs | 5 - src/unix/solarish/x86_64.rs | 82 - src/vxworks/mod.rs | 117 -- src/wasi.rs | 7 +- src/windows/gnu/align.rs | 6 +- src/windows/mod.rs | 3 - 109 files changed, 137 insertions(+), 10916 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 45691e3e7e948..246c041849433 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ Raw FFI bindings to platform libraries like libc. rust-version = "1.71.0" [package.metadata.docs.rs] -features = ["const-extern-fn", "extra_traits"] +features = ["const-extern-fn"] default-target = "x86_64-unknown-linux-gnu" targets = [ "aarch64-apple-darwin", @@ -138,7 +138,6 @@ default = ["std"] std = [] align = [] rustc-dep-of-std = ['align', 'rustc-std-workspace-core'] -extra_traits = [] const-extern-fn = [] [workspace] diff --git a/README.md b/README.md index 4b72be03179aa..f1564cef6ffe1 100644 --- a/README.md +++ b/README.md @@ -40,9 +40,6 @@ libc = "0.2" feature to remove this dependency and be able to use `libc` in `#![no_std]` crates. -* `extra_traits`: all `struct`s implemented in `libc` are `Copy` and `Clone`. - This feature derives `Debug`, `Eq`, `Hash`, and `PartialEq`. - * `const-extern-fn`: Changes some `extern fn`s into `const extern fn`s. If you use Rust >= 1.62, this feature is implicitly enabled. Otherwise it requires a nightly rustc. diff --git a/ci/build.sh b/ci/build.sh index e22b893222312..3d4c25e4af671 100644 --- a/ci/build.sh +++ b/ci/build.sh @@ -56,16 +56,6 @@ test_target() { -Z build-std=core,alloc -vv --target "${TARGET}" fi - # Test that libc builds with the `extra_traits` feature - if [ "${NO_STD}" != "1" ]; then - cargo "+${RUST}" "${BUILD_CMD}" -vv --no-default-features --target "${TARGET}" \ - --features extra_traits - else - RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \ - -Z build-std=core,alloc -vv --no-default-features \ - --target "${TARGET}" --features extra_traits - fi - # Test the 'const-extern-fn' feature on nightly if [ "${RUST}" = "nightly" ]; then if [ "${NO_STD}" != "1" ]; then @@ -77,16 +67,6 @@ test_target() { --target "${TARGET}" --features const-extern-fn fi fi - - # Also test that it builds with `extra_traits` and default features: - if [ "$NO_STD" != "1" ]; then - cargo "+${RUST}" "${BUILD_CMD}" -vv --target "${TARGET}" \ - --features extra_traits - else - RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \ - -Z build-std=core,alloc -vv --target "${TARGET}" \ - --features extra_traits - fi } RUST_LINUX_TARGETS="\ diff --git a/ci/run.sh b/ci/run.sh index 4de8087699e24..87bfef250a977 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -101,7 +101,7 @@ if [ "$TARGET" = "s390x-unknown-linux-gnu" ]; then continue fi elif [ "$passed" = "2" ]; then - if cargo test --features extra_traits --manifest-path libc-test/Cargo.toml --target "${TARGET}" ${LIBC_CI_ZBUILD_STD+"-Zbuild-std"}; then + if cargo test --manifest-path libc-test/Cargo.toml --target "${TARGET}" ${LIBC_CI_ZBUILD_STD+"-Zbuild-std"}; then break fi fi @@ -114,6 +114,6 @@ else cargo test --manifest-path libc-test/Cargo.toml --target "${TARGET}" ${LIBC_CI_ZBUILD_STD+"-Zbuild-std"} - RUST_BACKTRACE=1 cargo test --features extra_traits --manifest-path libc-test/Cargo.toml \ + RUST_BACKTRACE=1 cargo test --manifest-path libc-test/Cargo.toml \ --target "${TARGET}" ${LIBC_CI_ZBUILD_STD+"-Zbuild-std"} fi diff --git a/ci/style.rs b/ci/style.rs index 31adeae4fbde7..8665259e7faa5 100644 --- a/ci/style.rs +++ b/ci/style.rs @@ -142,9 +142,6 @@ fn check_style(file: &str, path: &Path, err: &mut Errors) { } else if line.starts_with("s! {") { s_macros += 1; State::Structs - } else if line.starts_with("s_no_extra_traits! {") { - // multiple macros of this type are allowed - State::Structs } else if line.starts_with("s_paren! {") { // multiple macros of this type are allowed State::Structs diff --git a/libc-test/Cargo.toml b/libc-test/Cargo.toml index 20543d69bcb0f..222b418c493fa 100644 --- a/libc-test/Cargo.toml +++ b/libc-test/Cargo.toml @@ -24,7 +24,6 @@ ctest2 = "0.4.3" default = ["std"] std = ["libc/std"] align = ["libc/align"] -extra_traits = ["libc/extra_traits"] [[test]] name = "main" diff --git a/src/fuchsia/align.rs b/src/fuchsia/align.rs index 3409bf0c61955..5abd166e9b538 100644 --- a/src/fuchsia/align.rs +++ b/src/fuchsia/align.rs @@ -29,9 +29,7 @@ macro_rules! expand_align { pub struct pthread_condattr_t { size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T], } - } - s_no_extra_traits! { #[cfg_attr(all(target_pointer_width = "32", any(target_arch = "arm", target_arch = "x86_64")), @@ -68,75 +66,5 @@ macro_rules! expand_align { size: [u8; ::__SIZEOF_PTHREAD_COND_T], } } - - cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for pthread_cond_t { - fn eq(&self, other: &pthread_cond_t) -> bool { - self.size - .iter() - .zip(other.size.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for pthread_cond_t {} - impl ::fmt::Debug for pthread_cond_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("pthread_cond_t") - // FIXME: .field("size", &self.size) - .finish() - } - } - impl ::hash::Hash for pthread_cond_t { - fn hash(&self, state: &mut H) { - self.size.hash(state); - } - } - - impl PartialEq for pthread_mutex_t { - fn eq(&self, other: &pthread_mutex_t) -> bool { - self.size - .iter() - .zip(other.size.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for pthread_mutex_t {} - impl ::fmt::Debug for pthread_mutex_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("pthread_mutex_t") - // FIXME: .field("size", &self.size) - .finish() - } - } - impl ::hash::Hash for pthread_mutex_t { - fn hash(&self, state: &mut H) { - self.size.hash(state); - } - } - - impl PartialEq for pthread_rwlock_t { - fn eq(&self, other: &pthread_rwlock_t) -> bool { - self.size - .iter() - .zip(other.size.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for pthread_rwlock_t {} - impl ::fmt::Debug for pthread_rwlock_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("pthread_rwlock_t") - // FIXME: .field("size", &self.size) - .finish() - } - } - impl ::hash::Hash for pthread_rwlock_t { - fn hash(&self, state: &mut H) { - self.size.hash(state); - } - } - } - } }; } diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs index 65d7e9005ddfe..d88deb7509951 100644 --- a/src/fuchsia/mod.rs +++ b/src/fuchsia/mod.rs @@ -91,7 +91,6 @@ pub type c_ulong = u64; // FIXME: why are these uninhabited types? that seems... wrong? // Presumably these should be `()` or an `extern type` (when that stabilizes). -#[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum timezone {} impl ::Copy for timezone {} impl ::Clone for timezone { @@ -99,7 +98,6 @@ impl ::Clone for timezone { *self } } -#[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum DIR {} impl ::Copy for DIR {} impl ::Clone for DIR { @@ -108,7 +106,6 @@ impl ::Clone for DIR { } } -#[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum fpos64_t {} // FIXME: fill this out with a struct impl ::Copy for fpos64_t {} impl ::Clone for fpos64_t { @@ -882,9 +879,7 @@ s! { pub ipi6_addr: ::in6_addr, pub ipi6_ifindex: ::c_uint, } -} -s_no_extra_traits! { pub struct sysinfo { pub uptime: ::c_ulong, pub loads: [::c_ulong; 3], @@ -981,334 +976,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for sysinfo { - fn eq(&self, other: &sysinfo) -> bool { - self.uptime == other.uptime - && self.loads == other.loads - && self.totalram == other.totalram - && self.freeram == other.freeram - && self.sharedram == other.sharedram - && self.bufferram == other.bufferram - && self.totalswap == other.totalswap - && self.freeswap == other.freeswap - && self.procs == other.procs - && self.pad == other.pad - && self.totalhigh == other.totalhigh - && self.freehigh == other.freehigh - && self.mem_unit == other.mem_unit - && self - .__reserved - .iter() - .zip(other.__reserved.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for sysinfo {} - impl ::fmt::Debug for sysinfo { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sysinfo") - .field("uptime", &self.uptime) - .field("loads", &self.loads) - .field("totalram", &self.totalram) - .field("freeram", &self.freeram) - .field("sharedram", &self.sharedram) - .field("bufferram", &self.bufferram) - .field("totalswap", &self.totalswap) - .field("freeswap", &self.freeswap) - .field("procs", &self.procs) - .field("pad", &self.pad) - .field("totalhigh", &self.totalhigh) - .field("freehigh", &self.freehigh) - .field("mem_unit", &self.mem_unit) - // FIXME: .field("__reserved", &self.__reserved) - .finish() - } - } - impl ::hash::Hash for sysinfo { - fn hash(&self, state: &mut H) { - self.uptime.hash(state); - self.loads.hash(state); - self.totalram.hash(state); - self.freeram.hash(state); - self.sharedram.hash(state); - self.bufferram.hash(state); - self.totalswap.hash(state); - self.freeswap.hash(state); - self.procs.hash(state); - self.pad.hash(state); - self.totalhigh.hash(state); - self.freehigh.hash(state); - self.mem_unit.hash(state); - self.__reserved.hash(state); - } - } - - impl PartialEq for sockaddr_un { - fn eq(&self, other: &sockaddr_un) -> bool { - self.sun_family == other.sun_family - && self - .sun_path - .iter() - .zip(other.sun_path.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for sockaddr_un {} - impl ::fmt::Debug for sockaddr_un { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_un") - .field("sun_family", &self.sun_family) - // FIXME: .field("sun_path", &self.sun_path) - .finish() - } - } - impl ::hash::Hash for sockaddr_un { - fn hash(&self, state: &mut H) { - self.sun_family.hash(state); - self.sun_path.hash(state); - } - } - - impl PartialEq for sockaddr_storage { - fn eq(&self, other: &sockaddr_storage) -> bool { - self.ss_family == other.ss_family - && self.__ss_align == other.__ss_align - && self - .__ss_pad2 - .iter() - .zip(other.__ss_pad2.iter()) - .all(|(a, b)| a == b) - } - } - impl Eq for sockaddr_storage {} - impl ::fmt::Debug for sockaddr_storage { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_storage") - .field("ss_family", &self.ss_family) - .field("__ss_align", &self.__ss_align) - // FIXME: .field("__ss_pad2", &self.__ss_pad2) - .finish() - } - } - impl ::hash::Hash for sockaddr_storage { - fn hash(&self, state: &mut H) { - self.ss_family.hash(state); - self.__ss_align.hash(state); - self.__ss_pad2.hash(state); - } - } - - impl PartialEq for utsname { - fn eq(&self, other: &utsname) -> bool { - self.sysname - .iter() - .zip(other.sysname.iter()) - .all(|(a,b)| a == b) - && self - .nodename - .iter() - .zip(other.nodename.iter()) - .all(|(a,b)| a == b) - && self - .release - .iter() - .zip(other.release.iter()) - .all(|(a,b)| a == b) - && self - .version - .iter() - .zip(other.version.iter()) - .all(|(a,b)| a == b) - && self - .machine - .iter() - .zip(other.machine.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for utsname {} - impl ::fmt::Debug for utsname { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("utsname") - // FIXME: .field("sysname", &self.sysname) - // FIXME: .field("nodename", &self.nodename) - // FIXME: .field("release", &self.release) - // FIXME: .field("version", &self.version) - // FIXME: .field("machine", &self.machine) - .finish() - } - } - impl ::hash::Hash for utsname { - fn hash(&self, state: &mut H) { - self.sysname.hash(state); - self.nodename.hash(state); - self.release.hash(state); - self.version.hash(state); - self.machine.hash(state); - } - } - - impl PartialEq for dirent { - fn eq(&self, other: &dirent) -> bool { - self.d_ino == other.d_ino - && self.d_off == other.d_off - && self.d_reclen == other.d_reclen - && self.d_type == other.d_type - && self - .d_name - .iter() - .zip(other.d_name.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for dirent {} - impl ::fmt::Debug for dirent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("dirent") - .field("d_ino", &self.d_ino) - .field("d_off", &self.d_off) - .field("d_reclen", &self.d_reclen) - .field("d_type", &self.d_type) - // FIXME: .field("d_name", &self.d_name) - .finish() - } - } - impl ::hash::Hash for dirent { - fn hash(&self, state: &mut H) { - self.d_ino.hash(state); - self.d_off.hash(state); - self.d_reclen.hash(state); - self.d_type.hash(state); - self.d_name.hash(state); - } - } - - impl PartialEq for dirent64 { - fn eq(&self, other: &dirent64) -> bool { - self.d_ino == other.d_ino - && self.d_off == other.d_off - && self.d_reclen == other.d_reclen - && self.d_type == other.d_type - && self - .d_name - .iter() - .zip(other.d_name.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for dirent64 {} - impl ::fmt::Debug for dirent64 { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("dirent64") - .field("d_ino", &self.d_ino) - .field("d_off", &self.d_off) - .field("d_reclen", &self.d_reclen) - .field("d_type", &self.d_type) - // FIXME: .field("d_name", &self.d_name) - .finish() - } - } - impl ::hash::Hash for dirent64 { - fn hash(&self, state: &mut H) { - self.d_ino.hash(state); - self.d_off.hash(state); - self.d_reclen.hash(state); - self.d_type.hash(state); - self.d_name.hash(state); - } - } - - impl PartialEq for mq_attr { - fn eq(&self, other: &mq_attr) -> bool { - self.mq_flags == other.mq_flags && - self.mq_maxmsg == other.mq_maxmsg && - self.mq_msgsize == other.mq_msgsize && - self.mq_curmsgs == other.mq_curmsgs - } - } - impl Eq for mq_attr {} - impl ::fmt::Debug for mq_attr { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("mq_attr") - .field("mq_flags", &self.mq_flags) - .field("mq_maxmsg", &self.mq_maxmsg) - .field("mq_msgsize", &self.mq_msgsize) - .field("mq_curmsgs", &self.mq_curmsgs) - .finish() - } - } - impl ::hash::Hash for mq_attr { - fn hash(&self, state: &mut H) { - self.mq_flags.hash(state); - self.mq_maxmsg.hash(state); - self.mq_msgsize.hash(state); - self.mq_curmsgs.hash(state); - } - } - - impl PartialEq for sockaddr_nl { - fn eq(&self, other: &sockaddr_nl) -> bool { - self.nl_family == other.nl_family && - self.nl_pid == other.nl_pid && - self.nl_groups == other.nl_groups - } - } - impl Eq for sockaddr_nl {} - impl ::fmt::Debug for sockaddr_nl { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_nl") - .field("nl_family", &self.nl_family) - .field("nl_pid", &self.nl_pid) - .field("nl_groups", &self.nl_groups) - .finish() - } - } - impl ::hash::Hash for sockaddr_nl { - fn hash(&self, state: &mut H) { - self.nl_family.hash(state); - self.nl_pid.hash(state); - self.nl_groups.hash(state); - } - } - - impl PartialEq for sigevent { - fn eq(&self, other: &sigevent) -> bool { - self.sigev_value == other.sigev_value - && self.sigev_signo == other.sigev_signo - && self.sigev_notify == other.sigev_notify - && self.sigev_notify_function - == other.sigev_notify_function - && self.sigev_notify_attributes - == other.sigev_notify_attributes - } - } - impl Eq for sigevent {} - impl ::fmt::Debug for sigevent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sigevent") - .field("sigev_value", &self.sigev_value) - .field("sigev_signo", &self.sigev_signo) - .field("sigev_notify", &self.sigev_notify) - .field("sigev_notify_function", &self.sigev_notify_function) - .field("sigev_notify_attributes", - &self.sigev_notify_attributes) - .finish() - } - } - impl ::hash::Hash for sigevent { - fn hash(&self, state: &mut H) { - self.sigev_value.hash(state); - self.sigev_signo.hash(state); - self.sigev_notify.hash(state); - self.sigev_notify_function.hash(state); - self.sigev_notify_attributes.hash(state); - } - } - } -} - // PUB_CONST pub const INT_MIN: c_int = -2147483648; @@ -3428,7 +3095,6 @@ fn __MHDR_END(mhdr: *const msghdr) -> *mut c_uchar { #[link(name = "fdio")] extern "C" {} -#[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum FILE {} impl ::Copy for FILE {} impl ::Clone for FILE { @@ -3436,7 +3102,6 @@ impl ::Clone for FILE { *self } } -#[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum fpos_t {} // FIXME: fill this out with a struct impl ::Copy for fpos_t {} impl ::Clone for fpos_t { diff --git a/src/fuchsia/x86_64.rs b/src/fuchsia/x86_64.rs index dca3c247d8b83..4816baf24d85d 100644 --- a/src/fuchsia/x86_64.rs +++ b/src/fuchsia/x86_64.rs @@ -62,9 +62,7 @@ s! { __unused1: ::c_long, __unused2: ::c_long } -} -s_no_extra_traits! { pub struct ucontext_t { pub uc_flags: ::c_ulong, pub uc_link: *mut ucontext_t, @@ -75,48 +73,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for ucontext_t { - fn eq(&self, other: &ucontext_t) -> bool { - self.uc_flags == other.uc_flags - && self.uc_link == other.uc_link - && self.uc_stack == other.uc_stack - && self.uc_mcontext == other.uc_mcontext - && self.uc_sigmask == other.uc_sigmask - && self - .__private - .iter() - .zip(other.__private.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for ucontext_t {} - impl ::fmt::Debug for ucontext_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ucontext_t") - .field("uc_flags", &self.uc_flags) - .field("uc_link", &self.uc_link) - .field("uc_stack", &self.uc_stack) - .field("uc_mcontext", &self.uc_mcontext) - .field("uc_sigmask", &self.uc_sigmask) - // FIXME: .field("__private", &self.__private) - .finish() - } - } - impl ::hash::Hash for ucontext_t { - fn hash(&self, state: &mut H) { - self.uc_flags.hash(state); - self.uc_link.hash(state); - self.uc_stack.hash(state); - self.uc_mcontext.hash(state); - self.uc_sigmask.hash(state); - self.__private.hash(state); - } - } - } -} - // offsets in user_regs_structs, from sys/reg.h pub const R15: ::c_int = 0; pub const R14: ::c_int = 1; diff --git a/src/lib.rs b/src/lib.rs index 0fbc79d7fa3d0..eaf7bb55db407 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,7 +17,6 @@ // Attributes needed when building as part of the standard library #![cfg_attr(feature = "rustc-dep-of-std", feature(link_cfg, no_core))] // Enable extra lints: -#![cfg_attr(feature = "extra_traits", deny(missing_debug_implementations))] #![deny(missing_copy_implementations, safe_packed_borrows)] #![cfg_attr(not(feature = "rustc-dep-of-std"), no_std)] #![cfg_attr(feature = "rustc-dep-of-std", no_core)] diff --git a/src/macros.rs b/src/macros.rs index aa08505239c58..527c1f9bf7665 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -65,30 +65,6 @@ macro_rules! s { ($($(#[$attr:meta])* pub $t:ident $i:ident { $($field:tt)* })*) => ($( s!(it: $(#[$attr])* pub $t $i { $($field)* }); )*); - (it: $(#[$attr:meta])* pub union $i:ident { $($field:tt)* }) => ( - compile_error!("unions cannot derive extra traits, use s_no_extra_traits instead"); - ); - (it: $(#[$attr:meta])* pub struct $i:ident { $($field:tt)* }) => ( - __item! { - #[repr(C)] - #[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))] - #[allow(deprecated)] - $(#[$attr])* - pub struct $i { $($field)* } - } - #[allow(deprecated)] - impl ::Copy for $i {} - #[allow(deprecated)] - impl ::Clone for $i { - fn clone(&self) -> $i { *self } - } - ); -} - -macro_rules! s_no_extra_traits { - ($($(#[$attr:meta])* pub $t:ident $i:ident { $($field:tt)* })*) => ($( - s_no_extra_traits!(it: $(#[$attr])* pub $t $i { $($field)* }); - )*); (it: $(#[$attr:meta])* pub union $i:ident { $($field:tt)* }) => ( __item! { #[repr(C)] @@ -125,7 +101,6 @@ macro_rules! missing { macro_rules! e { ($($(#[$attr:meta])* pub enum $i:ident { $($field:tt)* })*) => ($( __item! { - #[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))] $(#[$attr])* pub enum $i { $($field)* } } @@ -139,7 +114,6 @@ macro_rules! e { macro_rules! s_paren { ($($(#[$attr:meta])* pub struct $i:ident ( $($field:tt)* ); )* ) => ($( __item! { - #[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))] $(#[$attr])* pub struct $i ( $($field)* ); } diff --git a/src/solid/mod.rs b/src/solid/mod.rs index 4c880796340eb..734eb5c97dd2d 100644 --- a/src/solid/mod.rs +++ b/src/solid/mod.rs @@ -403,7 +403,6 @@ pub const SIGUSR1: c_int = 30; pub const SIGUSR2: c_int = 31; pub const SIGPWR: c_int = 32; -#[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum FILE {} impl ::Copy for FILE {} impl ::Clone for FILE { @@ -411,7 +410,6 @@ impl ::Clone for FILE { *self } } -#[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum fpos_t {} impl ::Copy for fpos_t {} impl ::Clone for fpos_t { diff --git a/src/unix/aix/mod.rs b/src/unix/aix/mod.rs index 1e2dedee9bffb..a71c97da25bee 100644 --- a/src/unix/aix/mod.rs +++ b/src/unix/aix/mod.rs @@ -532,9 +532,7 @@ s! { pub it_interval: ::timespec, pub it_value: ::timespec, } -} -s_no_extra_traits! { pub union __sigaction_sa_union { pub __su_handler: extern fn(c: ::c_int), pub __su_sigaction: extern fn(c: ::c_int, info: *mut siginfo_t, ptr: *mut ::c_void), @@ -562,126 +560,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for __sigaction_sa_union { - fn eq(&self, other: &__sigaction_sa_union) -> bool { - unsafe { - self.__su_handler == other.__su_handler - && self.__su_sigaction == other.__su_sigaction - } - } - } - impl Eq for __sigaction_sa_union {} - impl ::fmt::Debug for __sigaction_sa_union { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("__sigaction_sa_union") - .field("__su_handler", unsafe { &self.__su_handler }) - .field("__su_sigaction", unsafe { &self.__su_sigaction }) - .finish() - } - } - impl ::hash::Hash for __sigaction_sa_union { - fn hash(&self, state: &mut H) { - unsafe { - self.__su_handler.hash(state); - self.__su_sigaction.hash(state); - } - } - } - - impl PartialEq for sigaction { - fn eq(&self, other: &sigaction) -> bool { - let union_eq = self.sa_union == other.sa_union; - self.sa_mask == other.sa_mask - && self.sa_flags == other.sa_flags - && union_eq - } - } - impl Eq for sigaction {} - impl ::fmt::Debug for sigaction { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let mut struct_formatter = f.debug_struct("sigaction"); - struct_formatter.field("sa_union", &self.sa_union); - struct_formatter.field("sa_mask", &self.sa_mask); - struct_formatter.field("sa_flags", &self.sa_flags); - struct_formatter.finish() - } - } - impl ::hash::Hash for sigaction { - fn hash(&self, state: &mut H) { - self.sa_union.hash(state); - self.sa_mask.hash(state); - self.sa_flags.hash(state); - } - } - - impl PartialEq for __poll_ctl_ext_u { - fn eq(&self, other: &__poll_ctl_ext_u) -> bool { - unsafe { - self.addr == other.addr - && self.data32 == other.data32 - && self.data == other.data - } - } - } - impl Eq for __poll_ctl_ext_u {} - impl ::fmt::Debug for __poll_ctl_ext_u { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("__poll_ctl_ext_u") - .field("addr", unsafe { &self.addr }) - .field("data32", unsafe { &self.data32 }) - .field("data", unsafe { &self.data }) - .finish() - } - } - impl ::hash::Hash for __poll_ctl_ext_u { - fn hash(&self, state: &mut H) { - unsafe { - self.addr.hash(state); - self.data32.hash(state); - self.data.hash(state); - } - } - } - - impl PartialEq for poll_ctl_ext { - fn eq(&self, other: &poll_ctl_ext) -> bool { - let union_eq = self.u == other.u; - self.version == other.version - && self.command == other.command - && self.events == other.events - && self.fd == other.fd - && self.reversed64 == other.reversed64 - && union_eq - } - } - impl Eq for poll_ctl_ext {} - impl ::fmt::Debug for poll_ctl_ext { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let mut struct_formatter = f.debug_struct("poll_ctl_ext"); - struct_formatter.field("version", &self.version); - struct_formatter.field("command", &self.command); - struct_formatter.field("events", &self.events); - struct_formatter.field("fd", &self.fd); - struct_formatter.field("u", &self.u); - struct_formatter.field("reversed64", &self.reversed64); - struct_formatter.finish() - } - } - impl ::hash::Hash for poll_ctl_ext { - fn hash(&self, state: &mut H) { - self.version.hash(state); - self.command.hash(state); - self.events.hash(state); - self.fd.hash(state); - self.u.hash(state); - self.reversed64.hash(state); - } - } - } -} - // dlfcn.h pub const RTLD_LAZY: ::c_int = 0x4; pub const RTLD_NOW: ::c_int = 0x2; diff --git a/src/unix/aix/powerpc64.rs b/src/unix/aix/powerpc64.rs index deec291b28dca..6e83530b9eb83 100644 --- a/src/unix/aix/powerpc64.rs +++ b/src/unix/aix/powerpc64.rs @@ -182,9 +182,7 @@ s! { pub msg_wwait: ::c_int, pub msg_reqevents: ::c_ushort, } -} -s_no_extra_traits! { pub struct siginfo_t { pub si_signo: ::c_int, pub si_errno: ::c_int, @@ -289,300 +287,6 @@ impl siginfo_t { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for siginfo_t { - fn eq(&self, other: &siginfo_t) -> bool { - self.si_signo == other.si_signo - && self.si_errno == other.si_errno - && self.si_code == other.si_code - && self.si_pid == other.si_pid - && self.si_uid == other.si_uid - && self.si_status == other.si_status - && self.si_addr == other.si_addr - && self.si_band == other.si_band - && self.__si_flags == other.__si_flags - && self.si_value == other.si_value - } - } - impl Eq for siginfo_t {} - impl ::fmt::Debug for siginfo_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let mut struct_formatter = f.debug_struct("siginfo_t"); - struct_formatter.field("si_signo", &self.si_signo); - struct_formatter.field("si_errno", &self.si_errno); - struct_formatter.field("si_code", &self.si_code); - struct_formatter.field("si_pid", &self.si_pid); - struct_formatter.field("si_uid", &self.si_uid); - struct_formatter.field("si_status", &self.si_status); - struct_formatter.field("si_addr", &self.si_addr); - struct_formatter.field("si_band", &self.si_band); - struct_formatter.field("si_value", &self.si_value); - struct_formatter.field("__si_flags", &self.__si_flags); - struct_formatter.finish() - } - } - impl ::hash::Hash for siginfo_t { - fn hash(&self, state: &mut H) { - self.si_signo.hash(state); - self.si_errno.hash(state); - self.si_code.hash(state); - self.si_pid.hash(state); - self.si_uid.hash(state); - self.si_status.hash(state); - self.si_addr.hash(state); - self.si_band.hash(state); - self.si_value.hash(state); - self.__si_flags.hash(state); - } - } - - impl PartialEq for _kernel_simple_lock { - fn eq(&self, other: &_kernel_simple_lock) -> bool { - unsafe { - self._slock == other._slock - && self._slockp == other._slockp - } - } - } - impl Eq for _kernel_simple_lock {} - impl ::fmt::Debug for _kernel_simple_lock { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("_kernel_simple_lock") - .field("_slock", unsafe { &self._slock }) - .field("_slockp", unsafe { &self._slockp }) - .finish() - } - } - impl ::hash::Hash for _kernel_simple_lock { - fn hash(&self, state: &mut H) { - unsafe { - self._slock.hash(state); - self._slockp.hash(state); - } - } - } - - impl PartialEq for fileops_t { - fn eq(&self, other: &fileops_t) -> bool { - self.fo_rw == other.fo_rw - && self.fo_ioctl == other.fo_ioctl - && self.fo_select == other.fo_select - && self.fo_close == other.fo_close - && self.fo_fstat == other.fo_fstat - } - } - impl Eq for fileops_t {} - impl ::fmt::Debug for fileops_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let mut struct_formatter = f.debug_struct("fileops_t"); - struct_formatter.field("fo_rw", &self.fo_rw); - struct_formatter.field("fo_ioctl", &self.fo_ioctl); - struct_formatter.field("fo_select", &self.fo_select); - struct_formatter.field("fo_close", &self.fo_close); - struct_formatter.field("fo_fstat", &self.fo_fstat); - struct_formatter.finish() - } - } - impl ::hash::Hash for fileops_t { - fn hash(&self, state: &mut H) { - self.fo_rw.hash(state); - self.fo_ioctl.hash(state); - self.fo_select.hash(state); - self.fo_close.hash(state); - self.fo_fstat.hash(state); - } - } - - impl PartialEq for file { - fn eq(&self, other: &file) -> bool { - self.f_flag == other.f_flag - && self.f_count == other.f_count - && self.f_options == other.f_options - && self.f_type == other.f_type - && self.f_data == other.f_data - && self.f_offset == other.f_offset - && self.f_dir_off == other.f_dir_off - && self.f_cred == other.f_cred - && self.f_vinfo == other.f_vinfo - && self.f_ops == other.f_ops - && self.f_parentp == other.f_parentp - && self.f_fnamep == other.f_fnamep - && self.f_fdata == other.f_fdata - && self.f_lock == other.f_lock - && self.f_offset_lock == other.f_offset_lock - } - } - impl Eq for file {} - impl ::fmt::Debug for file { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let mut struct_formatter = f.debug_struct("file"); - struct_formatter.field("f_flag", &self.f_flag); - struct_formatter.field("f_count", &self.f_count); - struct_formatter.field("f_options", &self.f_options); - struct_formatter.field("f_type", &self.f_type); - struct_formatter.field("f_data", &self.f_data); - struct_formatter.field("f_offset", &self.f_offset); - struct_formatter.field("f_dir_off", &self.f_dir_off); - struct_formatter.field("f_cred", &self.f_cred); - struct_formatter.field("f_lock", &self.f_lock); - struct_formatter.field("f_offset_lock", &self.f_offset_lock); - struct_formatter.field("f_vinfo", &self.f_vinfo); - struct_formatter.field("f_ops", &self.f_ops); - struct_formatter.field("f_parentp", &self.f_parentp); - struct_formatter.field("f_fnamep", &self.f_fnamep); - struct_formatter.field("f_fdata", &self.f_fdata); - struct_formatter.finish() - } - } - impl ::hash::Hash for file { - fn hash(&self, state: &mut H) { - self.f_flag.hash(state); - self.f_count.hash(state); - self.f_options.hash(state); - self.f_type.hash(state); - self.f_data.hash(state); - self.f_offset.hash(state); - self.f_dir_off.hash(state); - self.f_cred.hash(state); - self.f_lock.hash(state); - self.f_offset_lock.hash(state); - self.f_vinfo.hash(state); - self.f_ops.hash(state); - self.f_parentp.hash(state); - self.f_fnamep.hash(state); - self.f_fdata.hash(state); - } - } - - impl PartialEq for __ld_info_file { - fn eq(&self, other: &__ld_info_file) -> bool { - unsafe { - self._ldinfo_fd == other._ldinfo_fd - && self._ldinfo_fp == other._ldinfo_fp - && self._core_offset == other._core_offset - } - } - } - impl Eq for __ld_info_file {} - impl ::fmt::Debug for __ld_info_file { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("__ld_info_file") - .field("_ldinfo_fd", unsafe { &self._ldinfo_fd }) - .field("_ldinfo_fp", unsafe { &self._ldinfo_fp }) - .field("_core_offset", unsafe { &self._core_offset }) - .finish() - } - } - impl ::hash::Hash for __ld_info_file { - fn hash(&self, state: &mut H) { - unsafe { - self._ldinfo_fd.hash(state); - self._ldinfo_fp.hash(state); - self._core_offset.hash(state); - } - } - } - - impl PartialEq for ld_info { - fn eq(&self, other: &ld_info) -> bool { - self.ldinfo_next == other.ldinfo_next - && self.ldinfo_flags == other.ldinfo_flags - && self.ldinfo_textorg == other.ldinfo_textorg - && self.ldinfo_textsize == other.ldinfo_textsize - && self.ldinfo_dataorg == other.ldinfo_dataorg - && self.ldinfo_datasize == other.ldinfo_datasize - && self.ldinfo_filename == other.ldinfo_filename - && self._file == other._file - } - } - impl Eq for ld_info {} - impl ::fmt::Debug for ld_info { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let mut struct_formatter = f.debug_struct("ld_info"); - struct_formatter.field("ldinfo_next", &self.ldinfo_next); - struct_formatter.field("ldinfo_flags", &self.ldinfo_flags); - struct_formatter.field("ldinfo_textorg", &self.ldinfo_textorg); - struct_formatter.field("ldinfo_textsize", &self.ldinfo_textsize); - struct_formatter.field("ldinfo_dataorg", &self.ldinfo_dataorg); - struct_formatter.field("ldinfo_datasize", &self.ldinfo_datasize); - struct_formatter.field("ldinfo_filename", &self.ldinfo_filename); - struct_formatter.field("_file", &self._file); - struct_formatter.finish() - } - } - impl ::hash::Hash for ld_info { - fn hash(&self, state: &mut H) { - self.ldinfo_next.hash(state); - self.ldinfo_flags.hash(state); - self.ldinfo_textorg.hash(state); - self.ldinfo_textsize.hash(state); - self.ldinfo_dataorg.hash(state); - self.ldinfo_datasize.hash(state); - self.ldinfo_filename.hash(state); - self._file.hash(state); - } - } - - impl PartialEq for __pollfd_ext_u { - fn eq(&self, other: &__pollfd_ext_u) -> bool { - unsafe { - self.addr == other.addr - && self.data32 == other.data32 - && self.data == other.data - } - } - } - impl Eq for __pollfd_ext_u {} - impl ::fmt::Debug for __pollfd_ext_u { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("__pollfd_ext_u") - .field("addr", unsafe { &self.addr }) - .field("data32", unsafe { &self.data32 }) - .field("data", unsafe { &self.data }) - .finish() - } - } - impl ::hash::Hash for __pollfd_ext_u { - fn hash(&self, state: &mut H) { - unsafe { - self.addr.hash(state); - self.data.hash(state); - self.data32.hash(state); - } - } - } - - impl PartialEq for pollfd_ext { - fn eq(&self, other: &pollfd_ext) -> bool { - self.fd == other.fd - && self.events == other.events - && self.revents == other.revents - && self.data == other.data - } - } - impl Eq for pollfd_ext {} - impl ::fmt::Debug for pollfd_ext { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let mut struct_formatter = f.debug_struct("pollfd_ext"); - struct_formatter.field("fd", &self.fd); - struct_formatter.field("events", &self.events); - struct_formatter.field("revents", &self.revents); - struct_formatter.field("data", &self.data); - struct_formatter.finish() - } - } - impl ::hash::Hash for pollfd_ext { - fn hash(&self, state: &mut H) { - self.fd.hash(state); - self.events.hash(state); - self.revents.hash(state); - self.data.hash(state); - } - } - } -} - pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { __mt_word: [0, 2, 0, 0, 0, 0, 0, 0], }; diff --git a/src/unix/bsd/apple/b32/align.rs b/src/unix/bsd/apple/b32/align.rs index ca1fe1ce29944..3750130a1fb46 100644 --- a/src/unix/bsd/apple/b32/align.rs +++ b/src/unix/bsd/apple/b32/align.rs @@ -1,5 +1,4 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] +s! { #[repr(align(16))] pub struct max_align_t { priv_: [f64; 2] diff --git a/src/unix/bsd/apple/b32/mod.rs b/src/unix/bsd/apple/b32/mod.rs index 4707fa4c99991..f6d32b3ca42cf 100644 --- a/src/unix/bsd/apple/b32/mod.rs +++ b/src/unix/bsd/apple/b32/mod.rs @@ -47,44 +47,13 @@ s! { pub struct malloc_zone_t { __private: [::uintptr_t; 18], // FIXME: keeping private for now } -} -s_no_extra_traits! { pub struct pthread_attr_t { __sig: c_long, __opaque: [::c_char; 36] } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for pthread_attr_t { - fn eq(&self, other: &pthread_attr_t) -> bool { - self.__sig == other.__sig - && self.__opaque - .iter() - .zip(other.__opaque.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for pthread_attr_t {} - impl ::fmt::Debug for pthread_attr_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("pthread_attr_t") - .field("__sig", &self.__sig) - // FIXME: .field("__opaque", &self.__opaque) - .finish() - } - } - impl ::hash::Hash for pthread_attr_t { - fn hash(&self, state: &mut H) { - self.__sig.hash(state); - self.__opaque.hash(state); - } - } - } -} - #[doc(hidden)] #[deprecated(since = "0.2.55")] pub const NET_RT_MAXID: ::c_int = 10; diff --git a/src/unix/bsd/apple/b64/aarch64/align.rs b/src/unix/bsd/apple/b64/aarch64/align.rs index 7f86a134649cf..76a60b10f0532 100644 --- a/src/unix/bsd/apple/b64/aarch64/align.rs +++ b/src/unix/bsd/apple/b64/aarch64/align.rs @@ -1,13 +1,10 @@ pub type mcontext_t = *mut __darwin_mcontext64; -s_no_extra_traits! { - #[allow(missing_debug_implementations)] +s! { pub struct max_align_t { priv_: f64 } -} -s! { pub struct ucontext_t { pub uc_onstack: ::c_int, pub uc_sigmask: ::sigset_t, diff --git a/src/unix/bsd/apple/b64/align.rs b/src/unix/bsd/apple/b64/align.rs index ca1fe1ce29944..3750130a1fb46 100644 --- a/src/unix/bsd/apple/b64/align.rs +++ b/src/unix/bsd/apple/b64/align.rs @@ -1,5 +1,4 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] +s! { #[repr(align(16))] pub struct max_align_t { priv_: [f64; 2] diff --git a/src/unix/bsd/apple/b64/mod.rs b/src/unix/bsd/apple/b64/mod.rs index 48d94bcd6bfdc..3a450479ef91b 100644 --- a/src/unix/bsd/apple/b64/mod.rs +++ b/src/unix/bsd/apple/b64/mod.rs @@ -47,44 +47,13 @@ s! { pub bh_datalen: u32, pub bh_hdrlen: ::c_ushort, } -} -s_no_extra_traits! { pub struct pthread_attr_t { __sig: c_long, __opaque: [::c_char; 56] } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for pthread_attr_t { - fn eq(&self, other: &pthread_attr_t) -> bool { - self.__sig == other.__sig - && self.__opaque - .iter() - .zip(other.__opaque.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for pthread_attr_t {} - impl ::fmt::Debug for pthread_attr_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("pthread_attr_t") - .field("__sig", &self.__sig) - // FIXME: .field("__opaque", &self.__opaque) - .finish() - } - } - impl ::hash::Hash for pthread_attr_t { - fn hash(&self, state: &mut H) { - self.__sig.hash(state); - self.__opaque.hash(state); - } - } - } -} - #[doc(hidden)] #[deprecated(since = "0.2.55")] pub const NET_RT_MAXID: ::c_int = 11; diff --git a/src/unix/bsd/apple/b64/x86_64/align.rs b/src/unix/bsd/apple/b64/x86_64/align.rs index ca1fe1ce29944..3750130a1fb46 100644 --- a/src/unix/bsd/apple/b64/x86_64/align.rs +++ b/src/unix/bsd/apple/b64/x86_64/align.rs @@ -1,5 +1,4 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] +s! { #[repr(align(16))] pub struct max_align_t { priv_: [f64; 2] diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 77ac67151ac98..7b815564c04ae 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -159,7 +159,6 @@ pub type copyfile_callback_t = ::Option< pub type attrgroup_t = u32; pub type vol_capabilities_set_t = [u32; 4]; -#[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum timezone {} impl ::Copy for timezone {} impl ::Clone for timezone { @@ -168,7 +167,6 @@ impl ::Clone for timezone { } } -#[cfg_attr(feature = "extra_traits", derive(Debug))] #[repr(u32)] pub enum qos_class_t { QOS_CLASS_USER_INTERACTIVE = 0x21, @@ -185,7 +183,6 @@ impl ::Clone for qos_class_t { } } -#[cfg_attr(feature = "extra_traits", derive(Debug))] #[repr(u32)] pub enum sysdir_search_path_directory_t { SYSDIR_DIRECTORY_APPLICATION = 1, @@ -220,7 +217,6 @@ impl ::Clone for sysdir_search_path_directory_t { } } -#[cfg_attr(feature = "extra_traits", derive(Debug))] #[repr(u32)] pub enum sysdir_search_path_domain_mask_t { SYSDIR_DOMAIN_MASK_USER = (1 << 0), @@ -1136,9 +1132,7 @@ s! { pub tcpi_rxoutoforderbytes: u64, pub tcpi_rxretransmitpackets: u64, } -} -s_no_extra_traits! { #[repr(packed(4))] pub struct kevent { pub ident: ::uintptr_t, @@ -1473,6 +1467,12 @@ s_no_extra_traits! { pub ifcu_buf: *mut ::c_char, pub ifcu_req: *mut ifreq, } + + pub union semun { + pub val: ::c_int, + pub buf: *mut semid_ds, + pub array: *mut ::c_ushort, + } } impl siginfo_t { @@ -1509,1521 +1509,6 @@ impl siginfo_t { } } -s_no_extra_traits! { - pub union semun { - pub val: ::c_int, - pub buf: *mut semid_ds, - pub array: *mut ::c_ushort, - } -} - -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for semun { - fn eq(&self, other: &semun) -> bool { - unsafe { self.val == other.val } - } - } - impl Eq for semun {} - impl ::fmt::Debug for semun { - fn fmt(&self, f: &mut ::fmt::Formatter) - -> ::fmt::Result { - f.debug_struct("semun") - .field("val", unsafe { &self.val }) - .finish() - } - } - impl ::hash::Hash for semun { - fn hash(&self, state: &mut H) { - unsafe { self.val.hash(state) }; - } - } - } -} - -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for kevent { - fn eq(&self, other: &kevent) -> bool { - self.ident == other.ident - && self.filter == other.filter - && self.flags == other.flags - && self.fflags == other.fflags - && self.data == other.data - && self.udata == other.udata - } - } - impl Eq for kevent {} - impl ::fmt::Debug for kevent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let ident = self.ident; - let filter = self.filter; - let flags = self.flags; - let fflags = self.fflags; - let data = self.data; - let udata = self.udata; - f.debug_struct("kevent") - .field("ident", &ident) - .field("filter", &filter) - .field("flags", &flags) - .field("fflags", &fflags) - .field("data", &data) - .field("udata", &udata) - .finish() - } - } - impl ::hash::Hash for kevent { - fn hash(&self, state: &mut H) { - let ident = self.ident; - let filter = self.filter; - let flags = self.flags; - let fflags = self.fflags; - let data = self.data; - let udata = self.udata; - ident.hash(state); - filter.hash(state); - flags.hash(state); - fflags.hash(state); - data.hash(state); - udata.hash(state); - } - } - - impl PartialEq for semid_ds { - fn eq(&self, other: &semid_ds) -> bool { - let sem_perm = self.sem_perm; - let sem_pad3 = self.sem_pad3; - let other_sem_perm = other.sem_perm; - let other_sem_pad3 = other.sem_pad3; - sem_perm == other_sem_perm - && self.sem_base == other.sem_base - && self.sem_nsems == other.sem_nsems - && self.sem_otime == other.sem_otime - && self.sem_pad1 == other.sem_pad1 - && self.sem_ctime == other.sem_ctime - && self.sem_pad2 == other.sem_pad2 - && sem_pad3 == other_sem_pad3 - } - } - impl Eq for semid_ds {} - impl ::fmt::Debug for semid_ds { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let sem_perm = self.sem_perm; - let sem_base = self.sem_base; - let sem_nsems = self.sem_nsems; - let sem_otime = self.sem_otime; - let sem_pad1 = self.sem_pad1; - let sem_ctime = self.sem_ctime; - let sem_pad2 = self.sem_pad2; - let sem_pad3 = self.sem_pad3; - f.debug_struct("semid_ds") - .field("sem_perm", &sem_perm) - .field("sem_base", &sem_base) - .field("sem_nsems", &sem_nsems) - .field("sem_otime", &sem_otime) - .field("sem_pad1", &sem_pad1) - .field("sem_ctime", &sem_ctime) - .field("sem_pad2", &sem_pad2) - .field("sem_pad3", &sem_pad3) - .finish() - } - } - impl ::hash::Hash for semid_ds { - fn hash(&self, state: &mut H) { - let sem_perm = self.sem_perm; - let sem_base = self.sem_base; - let sem_nsems = self.sem_nsems; - let sem_otime = self.sem_otime; - let sem_pad1 = self.sem_pad1; - let sem_ctime = self.sem_ctime; - let sem_pad2 = self.sem_pad2; - let sem_pad3 = self.sem_pad3; - sem_perm.hash(state); - sem_base.hash(state); - sem_nsems.hash(state); - sem_otime.hash(state); - sem_pad1.hash(state); - sem_ctime.hash(state); - sem_pad2.hash(state); - sem_pad3.hash(state); - } - } - - impl PartialEq for shmid_ds { - fn eq(&self, other: &shmid_ds) -> bool { - let shm_perm = self.shm_perm; - let other_shm_perm = other.shm_perm; - shm_perm == other_shm_perm - && self.shm_segsz == other.shm_segsz - && self.shm_lpid == other.shm_lpid - && self.shm_cpid == other.shm_cpid - && self.shm_nattch == other.shm_nattch - && self.shm_atime == other.shm_atime - && self.shm_dtime == other.shm_dtime - && self.shm_ctime == other.shm_ctime - && self.shm_internal == other.shm_internal - } - } - impl Eq for shmid_ds {} - impl ::fmt::Debug for shmid_ds { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let shm_perm = self.shm_perm; - let shm_segsz = self.shm_segsz; - let shm_lpid = self.shm_lpid; - let shm_cpid = self.shm_cpid; - let shm_nattch = self.shm_nattch; - let shm_atime = self.shm_atime; - let shm_dtime = self.shm_dtime; - let shm_ctime = self.shm_ctime; - let shm_internal = self.shm_internal; - f.debug_struct("shmid_ds") - .field("shm_perm", &shm_perm) - .field("shm_segsz", &shm_segsz) - .field("shm_lpid", &shm_lpid) - .field("shm_cpid", &shm_cpid) - .field("shm_nattch", &shm_nattch) - .field("shm_atime", &shm_atime) - .field("shm_dtime", &shm_dtime) - .field("shm_ctime", &shm_ctime) - .field("shm_internal", &shm_internal) - .finish() - } - } - impl ::hash::Hash for shmid_ds { - fn hash(&self, state: &mut H) { - let shm_perm = self.shm_perm; - let shm_segsz = self.shm_segsz; - let shm_lpid = self.shm_lpid; - let shm_cpid = self.shm_cpid; - let shm_nattch = self.shm_nattch; - let shm_atime = self.shm_atime; - let shm_dtime = self.shm_dtime; - let shm_ctime = self.shm_ctime; - let shm_internal = self.shm_internal; - shm_perm.hash(state); - shm_segsz.hash(state); - shm_lpid.hash(state); - shm_cpid.hash(state); - shm_nattch.hash(state); - shm_atime.hash(state); - shm_dtime.hash(state); - shm_ctime.hash(state); - shm_internal.hash(state); - } - } - - impl PartialEq for proc_threadinfo { - fn eq(&self, other: &proc_threadinfo) -> bool { - self.pth_user_time == other.pth_user_time - && self.pth_system_time == other.pth_system_time - && self.pth_cpu_usage == other.pth_cpu_usage - && self.pth_policy == other.pth_policy - && self.pth_run_state == other.pth_run_state - && self.pth_flags == other.pth_flags - && self.pth_sleep_time == other.pth_sleep_time - && self.pth_curpri == other.pth_curpri - && self.pth_priority == other.pth_priority - && self.pth_maxpriority == other.pth_maxpriority - && self.pth_name - .iter() - .zip(other.pth_name.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for proc_threadinfo {} - impl ::fmt::Debug for proc_threadinfo { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("proc_threadinfo") - .field("pth_user_time", &self.pth_user_time) - .field("pth_system_time", &self.pth_system_time) - .field("pth_cpu_usage", &self.pth_cpu_usage) - .field("pth_policy", &self.pth_policy) - .field("pth_run_state", &self.pth_run_state) - .field("pth_flags", &self.pth_flags) - .field("pth_sleep_time", &self.pth_sleep_time) - .field("pth_curpri", &self.pth_curpri) - .field("pth_priority", &self.pth_priority) - .field("pth_maxpriority", &self.pth_maxpriority) - // FIXME: .field("pth_name", &self.pth_name) - .finish() - } - } - impl ::hash::Hash for proc_threadinfo { - fn hash(&self, state: &mut H) { - self.pth_user_time.hash(state); - self.pth_system_time.hash(state); - self.pth_cpu_usage.hash(state); - self.pth_policy.hash(state); - self.pth_run_state.hash(state); - self.pth_flags.hash(state); - self.pth_sleep_time.hash(state); - self.pth_curpri.hash(state); - self.pth_priority.hash(state); - self.pth_maxpriority.hash(state); - self.pth_name.hash(state); - } - } - - impl PartialEq for statfs { - fn eq(&self, other: &statfs) -> bool { - self.f_bsize == other.f_bsize - && self.f_iosize == other.f_iosize - && self.f_blocks == other.f_blocks - && self.f_bfree == other.f_bfree - && self.f_bavail == other.f_bavail - && self.f_files == other.f_files - && self.f_ffree == other.f_ffree - && self.f_fsid == other.f_fsid - && self.f_owner == other.f_owner - && self.f_flags == other.f_flags - && self.f_fssubtype == other.f_fssubtype - && self.f_fstypename == other.f_fstypename - && self.f_type == other.f_type - && self - .f_mntonname - .iter() - .zip(other.f_mntonname.iter()) - .all(|(a,b)| a == b) - && self - .f_mntfromname - .iter() - .zip(other.f_mntfromname.iter()) - .all(|(a,b)| a == b) - && self.f_reserved == other.f_reserved - } - } - - impl Eq for statfs {} - impl ::fmt::Debug for statfs { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("statfs") - .field("f_bsize", &self.f_bsize) - .field("f_iosize", &self.f_iosize) - .field("f_blocks", &self.f_blocks) - .field("f_bfree", &self.f_bfree) - .field("f_bavail", &self.f_bavail) - .field("f_files", &self.f_files) - .field("f_ffree", &self.f_ffree) - .field("f_fsid", &self.f_fsid) - .field("f_owner", &self.f_owner) - .field("f_flags", &self.f_flags) - .field("f_fssubtype", &self.f_fssubtype) - .field("f_fstypename", &self.f_fstypename) - .field("f_type", &self.f_type) - // FIXME: .field("f_mntonname", &self.f_mntonname) - // FIXME: .field("f_mntfromname", &self.f_mntfromname) - .field("f_reserved", &self.f_reserved) - .finish() - } - } - - impl ::hash::Hash for statfs { - fn hash(&self, state: &mut H) { - self.f_bsize.hash(state); - self.f_iosize.hash(state); - self.f_blocks.hash(state); - self.f_bfree.hash(state); - self.f_bavail.hash(state); - self.f_files.hash(state); - self.f_ffree.hash(state); - self.f_fsid.hash(state); - self.f_owner.hash(state); - self.f_flags.hash(state); - self.f_fssubtype.hash(state); - self.f_fstypename.hash(state); - self.f_type.hash(state); - self.f_mntonname.hash(state); - self.f_mntfromname.hash(state); - self.f_reserved.hash(state); - } - } - - impl PartialEq for dirent { - fn eq(&self, other: &dirent) -> bool { - self.d_ino == other.d_ino - && self.d_seekoff == other.d_seekoff - && self.d_reclen == other.d_reclen - && self.d_namlen == other.d_namlen - && self.d_type == other.d_type - && self - .d_name - .iter() - .zip(other.d_name.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for dirent {} - impl ::fmt::Debug for dirent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("dirent") - .field("d_ino", &self.d_ino) - .field("d_seekoff", &self.d_seekoff) - .field("d_reclen", &self.d_reclen) - .field("d_namlen", &self.d_namlen) - .field("d_type", &self.d_type) - // FIXME: .field("d_name", &self.d_name) - .finish() - } - } - impl ::hash::Hash for dirent { - fn hash(&self, state: &mut H) { - self.d_ino.hash(state); - self.d_seekoff.hash(state); - self.d_reclen.hash(state); - self.d_namlen.hash(state); - self.d_type.hash(state); - self.d_name.hash(state); - } - } - impl PartialEq for pthread_rwlock_t { - fn eq(&self, other: &pthread_rwlock_t) -> bool { - self.__sig == other.__sig - && self. - __opaque - .iter() - .zip(other.__opaque.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for pthread_rwlock_t {} - impl ::fmt::Debug for pthread_rwlock_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("pthread_rwlock_t") - .field("__sig", &self.__sig) - // FIXME: .field("__opaque", &self.__opaque) - .finish() - } - } - impl ::hash::Hash for pthread_rwlock_t { - fn hash(&self, state: &mut H) { - self.__sig.hash(state); - self.__opaque.hash(state); - } - } - - impl PartialEq for pthread_mutex_t { - fn eq(&self, other: &pthread_mutex_t) -> bool { - self.__sig == other.__sig - && self. - __opaque - .iter() - .zip(other.__opaque.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for pthread_mutex_t {} - - impl ::fmt::Debug for pthread_mutex_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("pthread_mutex_t") - .field("__sig", &self.__sig) - // FIXME: .field("__opaque", &self.__opaque) - .finish() - } - } - - impl ::hash::Hash for pthread_mutex_t { - fn hash(&self, state: &mut H) { - self.__sig.hash(state); - self.__opaque.hash(state); - } - } - - impl PartialEq for pthread_cond_t { - fn eq(&self, other: &pthread_cond_t) -> bool { - self.__sig == other.__sig - && self. - __opaque - .iter() - .zip(other.__opaque.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for pthread_cond_t {} - - impl ::fmt::Debug for pthread_cond_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("pthread_cond_t") - .field("__sig", &self.__sig) - // FIXME: .field("__opaque", &self.__opaque) - .finish() - } - } - - impl ::hash::Hash for pthread_cond_t { - fn hash(&self, state: &mut H) { - self.__sig.hash(state); - self.__opaque.hash(state); - } - } - - impl PartialEq for sockaddr_storage { - fn eq(&self, other: &sockaddr_storage) -> bool { - self.ss_len == other.ss_len - && self.ss_family == other.ss_family - && self - .__ss_pad1 - .iter() - .zip(other.__ss_pad1.iter()) - .all(|(a, b)| a == b) - && self.__ss_align == other.__ss_align - && self - .__ss_pad2 - .iter() - .zip(other.__ss_pad2.iter()) - .all(|(a, b)| a == b) - } - } - - impl Eq for sockaddr_storage {} - - impl ::fmt::Debug for sockaddr_storage { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_storage") - .field("ss_len", &self.ss_len) - .field("ss_family", &self.ss_family) - .field("__ss_pad1", &self.__ss_pad1) - .field("__ss_align", &self.__ss_align) - // FIXME: .field("__ss_pad2", &self.__ss_pad2) - .finish() - } - } - - impl ::hash::Hash for sockaddr_storage { - fn hash(&self, state: &mut H) { - self.ss_len.hash(state); - self.ss_family.hash(state); - self.__ss_pad1.hash(state); - self.__ss_align.hash(state); - self.__ss_pad2.hash(state); - } - } - - impl PartialEq for utmpx { - fn eq(&self, other: &utmpx) -> bool { - self.ut_user - .iter() - .zip(other.ut_user.iter()) - .all(|(a,b)| a == b) - && self.ut_id == other.ut_id - && self.ut_line == other.ut_line - && self.ut_pid == other.ut_pid - && self.ut_type == other.ut_type - && self.ut_tv == other.ut_tv - && self - .ut_host - .iter() - .zip(other.ut_host.iter()) - .all(|(a,b)| a == b) - && self.ut_pad == other.ut_pad - } - } - - impl Eq for utmpx {} - - impl ::fmt::Debug for utmpx { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("utmpx") - // FIXME: .field("ut_user", &self.ut_user) - .field("ut_id", &self.ut_id) - .field("ut_line", &self.ut_line) - .field("ut_pid", &self.ut_pid) - .field("ut_type", &self.ut_type) - .field("ut_tv", &self.ut_tv) - // FIXME: .field("ut_host", &self.ut_host) - .field("ut_pad", &self.ut_pad) - .finish() - } - } - - impl ::hash::Hash for utmpx { - fn hash(&self, state: &mut H) { - self.ut_user.hash(state); - self.ut_id.hash(state); - self.ut_line.hash(state); - self.ut_pid.hash(state); - self.ut_type.hash(state); - self.ut_tv.hash(state); - self.ut_host.hash(state); - self.ut_pad.hash(state); - } - } - - impl PartialEq for sigevent { - fn eq(&self, other: &sigevent) -> bool { - self.sigev_notify == other.sigev_notify - && self.sigev_signo == other.sigev_signo - && self.sigev_value == other.sigev_value - && self.sigev_notify_attributes - == other.sigev_notify_attributes - } - } - - impl Eq for sigevent {} - - impl ::fmt::Debug for sigevent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sigevent") - .field("sigev_notify", &self.sigev_notify) - .field("sigev_signo", &self.sigev_signo) - .field("sigev_value", &self.sigev_value) - .field("sigev_notify_attributes", - &self.sigev_notify_attributes) - .finish() - } - } - - impl ::hash::Hash for sigevent { - fn hash(&self, state: &mut H) { - self.sigev_notify.hash(state); - self.sigev_signo.hash(state); - self.sigev_value.hash(state); - self.sigev_notify_attributes.hash(state); - } - } - - impl PartialEq for processor_cpu_load_info { - fn eq(&self, other: &processor_cpu_load_info) -> bool { - self.cpu_ticks == other.cpu_ticks - } - } - impl Eq for processor_cpu_load_info {} - impl ::fmt::Debug for processor_cpu_load_info { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("processor_cpu_load_info") - .field("cpu_ticks", &self.cpu_ticks) - .finish() - } - } - impl ::hash::Hash for processor_cpu_load_info { - fn hash(&self, state: &mut H) { - self.cpu_ticks.hash(state); - } - } - - impl PartialEq for processor_basic_info { - fn eq(&self, other: &processor_basic_info) -> bool { - self.cpu_type == other.cpu_type - && self.cpu_subtype == other.cpu_subtype - && self.running == other.running - && self.slot_num == other.slot_num - && self.is_master == other.is_master - } - } - impl Eq for processor_basic_info {} - impl ::fmt::Debug for processor_basic_info { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("processor_basic_info") - .field("cpu_type", &self.cpu_type) - .field("cpu_subtype", &self.cpu_subtype) - .field("running", &self.running) - .field("slot_num", &self.slot_num) - .field("is_master", &self.is_master) - .finish() - } - } - impl ::hash::Hash for processor_basic_info { - fn hash(&self, state: &mut H) { - self.cpu_type.hash(state); - self.cpu_subtype.hash(state); - self.running.hash(state); - self.slot_num.hash(state); - self.is_master.hash(state); - } - } - - impl PartialEq for processor_set_basic_info { - fn eq(&self, other: &processor_set_basic_info) -> bool { - self.processor_count == other.processor_count - && self.default_policy == other.default_policy - } - } - impl Eq for processor_set_basic_info {} - impl ::fmt::Debug for processor_set_basic_info { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("processor_set_basic_info") - .field("processor_count", &self.processor_count) - .field("default_policy", &self.default_policy) - .finish() - } - } - impl ::hash::Hash for processor_set_basic_info { - fn hash(&self, state: &mut H) { - self.processor_count.hash(state); - self.default_policy.hash(state); - } - } - - impl PartialEq for processor_set_load_info { - fn eq(&self, other: &processor_set_load_info) -> bool { - self.task_count == other.task_count - && self.thread_count == other.thread_count - && self.load_average == other.load_average - && self.mach_factor == other.mach_factor - } - } - impl Eq for processor_set_load_info {} - impl ::fmt::Debug for processor_set_load_info { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("processor_set_load_info") - .field("task_count", &self.task_count) - .field("thread_count", &self.thread_count) - .field("load_average", &self.load_average) - .field("mach_factor", &self.mach_factor) - .finish() - } - } - impl ::hash::Hash for processor_set_load_info { - fn hash(&self, state: &mut H) { - self.task_count.hash(state); - self.thread_count.hash(state); - self.load_average.hash(state); - self.mach_factor.hash(state); - } - } - - impl PartialEq for time_value_t { - fn eq(&self, other: &time_value_t) -> bool { - self.seconds == other.seconds - && self.microseconds == other.microseconds - } - } - impl Eq for time_value_t {} - impl ::fmt::Debug for time_value_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("time_value_t") - .field("seconds", &self.seconds) - .field("microseconds", &self.microseconds) - .finish() - } - } - impl ::hash::Hash for time_value_t { - fn hash(&self, state: &mut H) { - self.seconds.hash(state); - self.microseconds.hash(state); - } - } - impl PartialEq for thread_basic_info { - fn eq(&self, other: &thread_basic_info) -> bool { - self.user_time == other.user_time - && self.system_time == other.system_time - && self.cpu_usage == other.cpu_usage - && self.policy == other.policy - && self.run_state == other.run_state - && self.flags == other.flags - && self.suspend_count == other.suspend_count - && self.sleep_time == other.sleep_time - } - } - impl Eq for thread_basic_info {} - impl ::fmt::Debug for thread_basic_info { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("thread_basic_info") - .field("user_time", &self.user_time) - .field("system_time", &self.system_time) - .field("cpu_usage", &self.cpu_usage) - .field("policy", &self.policy) - .field("run_state", &self.run_state) - .field("flags", &self.flags) - .field("suspend_count", &self.suspend_count) - .field("sleep_time", &self.sleep_time) - .finish() - } - } - impl ::hash::Hash for thread_basic_info { - fn hash(&self, state: &mut H) { - self.user_time.hash(state); - self.system_time.hash(state); - self.cpu_usage.hash(state); - self.policy.hash(state); - self.run_state.hash(state); - self.flags.hash(state); - self.suspend_count.hash(state); - self.sleep_time.hash(state); - } - } - impl PartialEq for thread_extended_info { - fn eq(&self, other: &thread_extended_info) -> bool { - self.pth_user_time == other.pth_user_time - && self.pth_system_time == other.pth_system_time - && self.pth_cpu_usage == other.pth_cpu_usage - && self.pth_policy == other.pth_policy - && self.pth_run_state == other.pth_run_state - && self.pth_flags == other.pth_flags - && self.pth_sleep_time == other.pth_sleep_time - && self.pth_curpri == other.pth_curpri - && self.pth_priority == other.pth_priority - && self.pth_maxpriority == other.pth_maxpriority - && self.pth_name - .iter() - .zip(other.pth_name.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for thread_extended_info {} - impl ::fmt::Debug for thread_extended_info { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("proc_threadinfo") - .field("pth_user_time", &self.pth_user_time) - .field("pth_system_time", &self.pth_system_time) - .field("pth_cpu_usage", &self.pth_cpu_usage) - .field("pth_policy", &self.pth_policy) - .field("pth_run_state", &self.pth_run_state) - .field("pth_flags", &self.pth_flags) - .field("pth_sleep_time", &self.pth_sleep_time) - .field("pth_curpri", &self.pth_curpri) - .field("pth_priority", &self.pth_priority) - .field("pth_maxpriority", &self.pth_maxpriority) - // FIXME: .field("pth_name", &self.pth_name) - .finish() - } - } - impl ::hash::Hash for thread_extended_info { - fn hash(&self, state: &mut H) { - self.pth_user_time.hash(state); - self.pth_system_time.hash(state); - self.pth_cpu_usage.hash(state); - self.pth_policy.hash(state); - self.pth_run_state.hash(state); - self.pth_flags.hash(state); - self.pth_sleep_time.hash(state); - self.pth_curpri.hash(state); - self.pth_priority.hash(state); - self.pth_maxpriority.hash(state); - self.pth_name.hash(state); - } - } - impl PartialEq for thread_identifier_info { - fn eq(&self, other: &thread_identifier_info) -> bool { - self.thread_id == other.thread_id - && self.thread_handle == other.thread_handle - && self.dispatch_qaddr == other.dispatch_qaddr - } - } - impl Eq for thread_identifier_info {} - impl ::fmt::Debug for thread_identifier_info { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("thread_identifier_info") - .field("thread_id", &self.thread_id) - .field("thread_handle", &self.thread_handle) - .field("dispatch_qaddr", &self.dispatch_qaddr) - .finish() - } - } - impl ::hash::Hash for thread_identifier_info { - fn hash(&self, state: &mut H) { - self.thread_id.hash(state); - self.thread_handle.hash(state); - self.dispatch_qaddr.hash(state); - } - } - impl PartialEq for if_data64 { - fn eq(&self, other: &if_data64) -> bool { - self.ifi_type == other.ifi_type && - self.ifi_typelen == other.ifi_typelen && - self.ifi_physical == other.ifi_physical && - self.ifi_addrlen == other.ifi_addrlen && - self.ifi_hdrlen == other.ifi_hdrlen && - self.ifi_recvquota == other.ifi_recvquota && - self.ifi_xmitquota == other.ifi_xmitquota && - self.ifi_unused1 == other.ifi_unused1 && - self.ifi_mtu == other.ifi_mtu && - self.ifi_metric == other.ifi_metric && - self.ifi_baudrate == other.ifi_baudrate && - self.ifi_ipackets == other.ifi_ipackets && - self.ifi_ierrors == other.ifi_ierrors && - self.ifi_opackets == other.ifi_opackets && - self.ifi_oerrors == other.ifi_oerrors && - self.ifi_collisions == other.ifi_collisions && - self.ifi_ibytes == other.ifi_ibytes && - self.ifi_obytes == other.ifi_obytes && - self.ifi_imcasts == other.ifi_imcasts && - self.ifi_omcasts == other.ifi_omcasts && - self.ifi_iqdrops == other.ifi_iqdrops && - self.ifi_noproto == other.ifi_noproto && - self.ifi_recvtiming == other.ifi_recvtiming && - self.ifi_xmittiming == other.ifi_xmittiming && - self.ifi_lastchange == other.ifi_lastchange - } - } - impl Eq for if_data64 {} - impl ::fmt::Debug for if_data64 { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let ifi_type = self.ifi_type; - let ifi_typelen = self.ifi_typelen; - let ifi_physical = self.ifi_physical; - let ifi_addrlen = self.ifi_addrlen; - let ifi_hdrlen = self.ifi_hdrlen; - let ifi_recvquota = self.ifi_recvquota; - let ifi_xmitquota = self.ifi_xmitquota; - let ifi_unused1 = self.ifi_unused1; - let ifi_mtu = self.ifi_mtu; - let ifi_metric = self.ifi_metric; - let ifi_baudrate = self.ifi_baudrate; - let ifi_ipackets = self.ifi_ipackets; - let ifi_ierrors = self.ifi_ierrors; - let ifi_opackets = self.ifi_opackets; - let ifi_oerrors = self.ifi_oerrors; - let ifi_collisions = self.ifi_collisions; - let ifi_ibytes = self.ifi_ibytes; - let ifi_obytes = self.ifi_obytes; - let ifi_imcasts = self.ifi_imcasts; - let ifi_omcasts = self.ifi_omcasts; - let ifi_iqdrops = self.ifi_iqdrops; - let ifi_noproto = self.ifi_noproto; - let ifi_recvtiming = self.ifi_recvtiming; - let ifi_xmittiming = self.ifi_xmittiming; - let ifi_lastchange = self.ifi_lastchange; - f.debug_struct("if_data64") - .field("ifi_type", &ifi_type) - .field("ifi_typelen", &ifi_typelen) - .field("ifi_physical", &ifi_physical) - .field("ifi_addrlen", &ifi_addrlen) - .field("ifi_hdrlen", &ifi_hdrlen) - .field("ifi_recvquota", &ifi_recvquota) - .field("ifi_xmitquota", &ifi_xmitquota) - .field("ifi_unused1", &ifi_unused1) - .field("ifi_mtu", &ifi_mtu) - .field("ifi_metric", &ifi_metric) - .field("ifi_baudrate", &ifi_baudrate) - .field("ifi_ipackets", &ifi_ipackets) - .field("ifi_ierrors", &ifi_ierrors) - .field("ifi_opackets", &ifi_opackets) - .field("ifi_oerrors", &ifi_oerrors) - .field("ifi_collisions", &ifi_collisions) - .field("ifi_ibytes", &ifi_ibytes) - .field("ifi_obytes", &ifi_obytes) - .field("ifi_imcasts", &ifi_imcasts) - .field("ifi_omcasts", &ifi_omcasts) - .field("ifi_iqdrops", &ifi_iqdrops) - .field("ifi_noproto", &ifi_noproto) - .field("ifi_recvtiming", &ifi_recvtiming) - .field("ifi_xmittiming", &ifi_xmittiming) - .field("ifi_lastchange", &ifi_lastchange) - .finish() - } - } - impl ::hash::Hash for if_data64 { - fn hash(&self, state: &mut H) { - let ifi_type = self.ifi_type; - let ifi_typelen = self.ifi_typelen; - let ifi_physical = self.ifi_physical; - let ifi_addrlen = self.ifi_addrlen; - let ifi_hdrlen = self.ifi_hdrlen; - let ifi_recvquota = self.ifi_recvquota; - let ifi_xmitquota = self.ifi_xmitquota; - let ifi_unused1 = self.ifi_unused1; - let ifi_mtu = self.ifi_mtu; - let ifi_metric = self.ifi_metric; - let ifi_baudrate = self.ifi_baudrate; - let ifi_ipackets = self.ifi_ipackets; - let ifi_ierrors = self.ifi_ierrors; - let ifi_opackets = self.ifi_opackets; - let ifi_oerrors = self.ifi_oerrors; - let ifi_collisions = self.ifi_collisions; - let ifi_ibytes = self.ifi_ibytes; - let ifi_obytes = self.ifi_obytes; - let ifi_imcasts = self.ifi_imcasts; - let ifi_omcasts = self.ifi_omcasts; - let ifi_iqdrops = self.ifi_iqdrops; - let ifi_noproto = self.ifi_noproto; - let ifi_recvtiming = self.ifi_recvtiming; - let ifi_xmittiming = self.ifi_xmittiming; - let ifi_lastchange = self.ifi_lastchange; - ifi_type.hash(state); - ifi_typelen.hash(state); - ifi_physical.hash(state); - ifi_addrlen.hash(state); - ifi_hdrlen.hash(state); - ifi_recvquota.hash(state); - ifi_xmitquota.hash(state); - ifi_unused1.hash(state); - ifi_mtu.hash(state); - ifi_metric.hash(state); - ifi_baudrate.hash(state); - ifi_ipackets.hash(state); - ifi_ierrors.hash(state); - ifi_opackets.hash(state); - ifi_oerrors.hash(state); - ifi_collisions.hash(state); - ifi_ibytes.hash(state); - ifi_obytes.hash(state); - ifi_imcasts.hash(state); - ifi_omcasts.hash(state); - ifi_iqdrops.hash(state); - ifi_noproto.hash(state); - ifi_recvtiming.hash(state); - ifi_xmittiming.hash(state); - ifi_lastchange.hash(state); - } - } - impl PartialEq for if_msghdr2 { - fn eq(&self, other: &if_msghdr2) -> bool { - self.ifm_msglen == other.ifm_msglen && - self.ifm_version == other.ifm_version && - self.ifm_type == other.ifm_type && - self.ifm_addrs == other.ifm_addrs && - self.ifm_flags == other.ifm_flags && - self.ifm_index == other.ifm_index && - self.ifm_snd_len == other.ifm_snd_len && - self.ifm_snd_maxlen == other.ifm_snd_maxlen && - self.ifm_snd_drops == other.ifm_snd_drops && - self.ifm_timer == other.ifm_timer && - self.ifm_data == other.ifm_data - } - } - impl Eq for if_msghdr2 {} - impl ::fmt::Debug for if_msghdr2 { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let ifm_msglen = self.ifm_msglen; - let ifm_version = self.ifm_version; - let ifm_type = self.ifm_type; - let ifm_addrs = self.ifm_addrs; - let ifm_flags = self.ifm_flags; - let ifm_index = self.ifm_index; - let ifm_snd_len = self.ifm_snd_len; - let ifm_snd_maxlen = self.ifm_snd_maxlen; - let ifm_snd_drops = self.ifm_snd_drops; - let ifm_timer = self.ifm_timer; - let ifm_data = self.ifm_data; - f.debug_struct("if_msghdr2") - .field("ifm_msglen", &ifm_msglen) - .field("ifm_version", &ifm_version) - .field("ifm_type", &ifm_type) - .field("ifm_addrs", &ifm_addrs) - .field("ifm_flags", &ifm_flags) - .field("ifm_index", &ifm_index) - .field("ifm_snd_len", &ifm_snd_len) - .field("ifm_snd_maxlen", &ifm_snd_maxlen) - .field("ifm_snd_drops", &ifm_snd_drops) - .field("ifm_timer", &ifm_timer) - .field("ifm_data", &ifm_data) - .finish() - } - } - impl ::hash::Hash for if_msghdr2 { - fn hash(&self, state: &mut H) { - let ifm_msglen = self.ifm_msglen; - let ifm_version = self.ifm_version; - let ifm_type = self.ifm_type; - let ifm_addrs = self.ifm_addrs; - let ifm_flags = self.ifm_flags; - let ifm_index = self.ifm_index; - let ifm_snd_len = self.ifm_snd_len; - let ifm_snd_maxlen = self.ifm_snd_maxlen; - let ifm_snd_drops = self.ifm_snd_drops; - let ifm_timer = self.ifm_timer; - let ifm_data = self.ifm_data; - ifm_msglen.hash(state); - ifm_version.hash(state); - ifm_type.hash(state); - ifm_addrs.hash(state); - ifm_flags.hash(state); - ifm_index.hash(state); - ifm_snd_len.hash(state); - ifm_snd_maxlen.hash(state); - ifm_snd_drops.hash(state); - ifm_timer.hash(state); - ifm_data.hash(state); - } - } - impl PartialEq for vm_statistics64 { - fn eq(&self, other: &vm_statistics64) -> bool { - // Otherwise rustfmt crashes... - let total_uncompressed = self.total_uncompressed_pages_in_compressor; - self.free_count == other.free_count && - self.active_count == other.active_count && - self.inactive_count == other.inactive_count && - self.wire_count == other.wire_count && - self.zero_fill_count == other.zero_fill_count && - self.reactivations == other.reactivations && - self.pageins == other.pageins && - self.pageouts == other.pageouts && - self.faults == other.faults && - self.cow_faults == other.cow_faults && - self.lookups == other.lookups && - self.hits == other.hits && - self.purges == other.purges && - self.purgeable_count == other.purgeable_count && - self.speculative_count == other.speculative_count && - self.decompressions == other.decompressions && - self.compressions == other.compressions && - self.swapins == other.swapins && - self.swapouts == other.swapouts && - self.compressor_page_count == other.compressor_page_count && - self.throttled_count == other.throttled_count && - self.external_page_count == other.external_page_count && - self.internal_page_count == other.internal_page_count && - total_uncompressed == other.total_uncompressed_pages_in_compressor - } - } - impl Eq for vm_statistics64 {} - impl ::fmt::Debug for vm_statistics64 { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let free_count = self.free_count; - let active_count = self.active_count; - let inactive_count = self.inactive_count; - let wire_count = self.wire_count; - let zero_fill_count = self.zero_fill_count; - let reactivations = self.reactivations; - let pageins = self.pageins; - let pageouts = self.pageouts; - let faults = self.faults; - let cow_faults = self.cow_faults; - let lookups = self.lookups; - let hits = self.hits; - let purges = self.purges; - let purgeable_count = self.purgeable_count; - let speculative_count = self.speculative_count; - let decompressions = self.decompressions; - let compressions = self.compressions; - let swapins = self.swapins; - let swapouts = self.swapouts; - let compressor_page_count = self.compressor_page_count; - let throttled_count = self.throttled_count; - let external_page_count = self.external_page_count; - let internal_page_count = self.internal_page_count; - // Otherwise rustfmt crashes... - let total_uncompressed = self.total_uncompressed_pages_in_compressor; - f.debug_struct("vm_statistics64") - .field("free_count", &free_count) - .field("active_count", &active_count) - .field("inactive_count", &inactive_count) - .field("wire_count", &wire_count) - .field("zero_fill_count", &zero_fill_count) - .field("reactivations", &reactivations) - .field("pageins", &pageins) - .field("pageouts", &pageouts) - .field("faults", &faults) - .field("cow_faults", &cow_faults) - .field("lookups", &lookups) - .field("hits", &hits) - .field("purges", &purges) - .field("purgeable_count", &purgeable_count) - .field("speculative_count", &speculative_count) - .field("decompressions", &decompressions) - .field("compressions", &compressions) - .field("swapins", &swapins) - .field("swapouts", &swapouts) - .field("compressor_page_count", &compressor_page_count) - .field("throttled_count", &throttled_count) - .field("external_page_count", &external_page_count) - .field("internal_page_count", &internal_page_count) - .field("total_uncompressed_pages_in_compressor", &total_uncompressed) - .finish() - } - } - impl ::hash::Hash for vm_statistics64 { - fn hash(&self, state: &mut H) { - let free_count = self.free_count; - let active_count = self.active_count; - let inactive_count = self.inactive_count; - let wire_count = self.wire_count; - let zero_fill_count = self.zero_fill_count; - let reactivations = self.reactivations; - let pageins = self.pageins; - let pageouts = self.pageouts; - let faults = self.faults; - let cow_faults = self.cow_faults; - let lookups = self.lookups; - let hits = self.hits; - let purges = self.purges; - let purgeable_count = self.purgeable_count; - let speculative_count = self.speculative_count; - let decompressions = self.decompressions; - let compressions = self.compressions; - let swapins = self.swapins; - let swapouts = self.swapouts; - let compressor_page_count = self.compressor_page_count; - let throttled_count = self.throttled_count; - let external_page_count = self.external_page_count; - let internal_page_count = self.internal_page_count; - // Otherwise rustfmt crashes... - let total_uncompressed = self.total_uncompressed_pages_in_compressor; - free_count.hash(state); - active_count.hash(state); - inactive_count.hash(state); - wire_count.hash(state); - zero_fill_count.hash(state); - reactivations.hash(state); - pageins.hash(state); - pageouts.hash(state); - faults.hash(state); - cow_faults.hash(state); - lookups.hash(state); - hits.hash(state); - purges.hash(state); - purgeable_count.hash(state); - speculative_count.hash(state); - decompressions.hash(state); - compressions.hash(state); - swapins.hash(state); - swapouts.hash(state); - compressor_page_count.hash(state); - throttled_count.hash(state); - external_page_count.hash(state); - internal_page_count.hash(state); - total_uncompressed.hash(state); - } - } - - impl PartialEq for mach_task_basic_info { - fn eq(&self, other: &mach_task_basic_info) -> bool { - self.virtual_size == other.virtual_size - && self.resident_size == other.resident_size - && self.resident_size_max == other.resident_size_max - && self.user_time == other.user_time - && self.system_time == other.system_time - && self.policy == other.policy - && self.suspend_count == other.suspend_count - } - } - impl Eq for mach_task_basic_info {} - impl ::fmt::Debug for mach_task_basic_info { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let virtual_size = self.virtual_size; - let resident_size = self.resident_size; - let resident_size_max = self.resident_size_max; - let user_time = self.user_time; - let system_time = self.system_time; - let policy = self.policy; - let suspend_count = self.suspend_count; - f.debug_struct("mach_task_basic_info") - .field("virtual_size", &virtual_size) - .field("resident_size", &resident_size) - .field("resident_size_max", &resident_size_max) - .field("user_time", &user_time) - .field("system_time", &system_time) - .field("policy", &policy) - .field("suspend_count", &suspend_count) - .finish() - } - } - impl ::hash::Hash for mach_task_basic_info { - fn hash(&self, state: &mut H) { - let virtual_size = self.virtual_size; - let resident_size = self.resident_size; - let resident_size_max = self.resident_size_max; - let user_time = self.user_time; - let system_time = self.system_time; - let policy = self.policy; - let suspend_count = self.suspend_count; - virtual_size.hash(state); - resident_size.hash(state); - resident_size_max.hash(state); - user_time.hash(state); - system_time.hash(state); - policy.hash(state); - suspend_count.hash(state); - } - } - - impl PartialEq for log2phys { - fn eq(&self, other: &log2phys) -> bool { - self.l2p_flags == other.l2p_flags - && self.l2p_contigbytes == other.l2p_contigbytes - && self.l2p_devoffset == other.l2p_devoffset - } - } - impl Eq for log2phys {} - impl ::fmt::Debug for log2phys { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let l2p_flags = self.l2p_flags; - let l2p_contigbytes = self.l2p_contigbytes; - let l2p_devoffset = self.l2p_devoffset; - f.debug_struct("log2phys") - .field("l2p_flags", &l2p_flags) - .field("l2p_contigbytes", &l2p_contigbytes) - .field("l2p_devoffset", &l2p_devoffset) - .finish() - } - } - impl ::hash::Hash for log2phys { - fn hash(&self, state: &mut H) { - let l2p_flags = self.l2p_flags; - let l2p_contigbytes = self.l2p_contigbytes; - let l2p_devoffset = self.l2p_devoffset; - l2p_flags.hash(state); - l2p_contigbytes.hash(state); - l2p_devoffset.hash(state); - } - } - impl PartialEq for os_unfair_lock { - fn eq(&self, other: &os_unfair_lock) -> bool { - self._os_unfair_lock_opaque == other._os_unfair_lock_opaque - } - } - - impl Eq for os_unfair_lock {} - - impl ::fmt::Debug for os_unfair_lock { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("os_unfair_lock") - .field("_os_unfair_lock_opaque", &self._os_unfair_lock_opaque) - .finish() - } - } - - impl ::hash::Hash for os_unfair_lock { - fn hash(&self, state: &mut H) { - self._os_unfair_lock_opaque.hash(state); - } - } - - impl PartialEq for sockaddr_vm { - fn eq(&self, other: &sockaddr_vm) -> bool { - self.svm_len == other.svm_len - && self.svm_family == other.svm_family - && self.svm_reserved1 == other.svm_reserved1 - && self.svm_port == other.svm_port - && self.svm_cid == other.svm_cid - } - } - - impl Eq for sockaddr_vm {} - - impl ::fmt::Debug for sockaddr_vm { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let svm_len = self.svm_len; - let svm_family = self.svm_family; - let svm_reserved1 = self.svm_reserved1; - let svm_port = self.svm_port; - let svm_cid = self.svm_cid; - - f.debug_struct("sockaddr_vm") - .field("svm_len",&svm_len) - .field("svm_family",&svm_family) - .field("svm_reserved1",&svm_reserved1) - .field("svm_port",&svm_port) - .field("svm_cid",&svm_cid) - .finish() - } - } - - impl ::hash::Hash for sockaddr_vm { - fn hash(&self, state: &mut H) { - let svm_len = self.svm_len; - let svm_family = self.svm_family; - let svm_reserved1 = self.svm_reserved1; - let svm_port = self.svm_port; - let svm_cid = self.svm_cid; - - svm_len.hash(state); - svm_family.hash(state); - svm_reserved1.hash(state); - svm_port.hash(state); - svm_cid.hash(state); - } - } - - impl PartialEq for ifdevmtu { - fn eq(&self, other: &ifdevmtu) -> bool { - self.ifdm_current == other.ifdm_current - && self.ifdm_min == other.ifdm_min - && self.ifdm_max == other.ifdm_max - } - } - - impl Eq for ifdevmtu {} - - impl ::fmt::Debug for ifdevmtu { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ifdevmtu") - .field("ifdm_current", &self.ifdm_current) - .field("ifdm_min", &self.ifdm_min) - .field("ifdm_max", &self.ifdm_max) - .finish() - } - } - - impl ::hash::Hash for ifdevmtu { - fn hash(&self, state: &mut H) { - self.ifdm_current.hash(state); - self.ifdm_min.hash(state); - self.ifdm_max.hash(state); - } - } - - impl PartialEq for __c_anonymous_ifk_data { - fn eq(&self, other: &__c_anonymous_ifk_data) -> bool { - unsafe { - self.ifk_ptr == other.ifk_ptr - && self.ifk_value == other.ifk_value - } - } - } - - impl Eq for __c_anonymous_ifk_data {} - - impl ::fmt::Debug for __c_anonymous_ifk_data { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("__c_anonymous_ifk_data") - .field("ifk_ptr", unsafe { &self.ifk_ptr }) - .field("ifk_value", unsafe { &self.ifk_value }) - .finish() - } - } - impl ::hash::Hash for __c_anonymous_ifk_data { - fn hash(&self, state: &mut H) { - unsafe { - self.ifk_ptr.hash(state); - self.ifk_value.hash(state); - } - } - } - - impl PartialEq for ifkpi { - fn eq(&self, other: &ifkpi) -> bool { - self.ifk_module_id == other.ifk_module_id - && self.ifk_type == other.ifk_type - } - } - - impl Eq for ifkpi {} - - impl ::fmt::Debug for ifkpi { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ifkpi") - .field("ifk_module_id", &self.ifk_module_id) - .field("ifk_type", &self.ifk_type) - .finish() - } - } - - impl ::hash::Hash for ifkpi { - fn hash(&self, state: &mut H) { - self.ifk_module_id.hash(state); - self.ifk_type.hash(state); - } - } - - impl PartialEq for __c_anonymous_ifr_ifru { - fn eq(&self, other: &__c_anonymous_ifr_ifru) -> bool { - unsafe { - self.ifru_addr == other.ifru_addr - && self.ifru_dstaddr == other.ifru_dstaddr - && self.ifru_broadaddr == other.ifru_broadaddr - && self.ifru_flags == other.ifru_flags - && self.ifru_metrics == other.ifru_metrics - && self.ifru_mtu == other.ifru_mtu - && self.ifru_phys == other.ifru_phys - && self.ifru_media == other.ifru_media - && self.ifru_intval == other.ifru_intval - && self.ifru_data == other.ifru_data - && self.ifru_devmtu == other.ifru_devmtu - && self.ifru_kpi == other.ifru_kpi - && self.ifru_wake_flags == other.ifru_wake_flags - && self.ifru_route_refcnt == other.ifru_route_refcnt - && self.ifru_cap.iter().zip(other.ifru_cap.iter()).all(|(a,b)| a == b) - && self.ifru_functional_type == other.ifru_functional_type - } - } - } - - impl Eq for __c_anonymous_ifr_ifru {} - - impl ::fmt::Debug for __c_anonymous_ifr_ifru { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("__c_anonymous_ifr_ifru") - .field("ifru_addr", unsafe { &self.ifru_addr }) - .field("ifru_dstaddr", unsafe { &self.ifru_dstaddr }) - .field("ifru_broadaddr", unsafe { &self.ifru_broadaddr }) - .field("ifru_flags", unsafe { &self.ifru_flags }) - .field("ifru_metrics", unsafe { &self.ifru_metrics }) - .field("ifru_mtu", unsafe { &self.ifru_mtu }) - .field("ifru_phys", unsafe { &self.ifru_phys }) - .field("ifru_media", unsafe { &self.ifru_media }) - .field("ifru_intval", unsafe { &self.ifru_intval }) - .field("ifru_data", unsafe { &self.ifru_data }) - .field("ifru_devmtu", unsafe { &self.ifru_devmtu }) - .field("ifru_kpi", unsafe { &self.ifru_kpi }) - .field("ifru_wake_flags", unsafe { &self.ifru_wake_flags }) - .field("ifru_route_refcnt", unsafe { &self.ifru_route_refcnt }) - .field("ifru_cap", unsafe { &self.ifru_cap }) - .field("ifru_functional_type", unsafe { &self.ifru_functional_type }) - .finish() - } - } - - impl ::hash::Hash for __c_anonymous_ifr_ifru { - fn hash(&self, state: &mut H) { - unsafe { - self.ifru_addr.hash(state); - self.ifru_dstaddr.hash(state); - self.ifru_broadaddr.hash(state); - self.ifru_flags.hash(state); - self.ifru_metrics.hash(state); - self.ifru_mtu.hash(state); - self.ifru_phys.hash(state); - self.ifru_media.hash(state); - self.ifru_intval.hash(state); - self.ifru_data.hash(state); - self.ifru_devmtu.hash(state); - self.ifru_kpi.hash(state); - self.ifru_wake_flags.hash(state); - self.ifru_route_refcnt.hash(state); - self.ifru_cap.hash(state); - self.ifru_functional_type.hash(state); - } - } - } - - impl PartialEq for ifreq { - fn eq(&self, other: &ifreq) -> bool { - self.ifr_name == other.ifr_name - && self.ifr_ifru == other.ifr_ifru - } - } - - impl Eq for ifreq {} - - impl ::fmt::Debug for ifreq { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ifreq") - .field("ifr_name", &self.ifr_name) - .field("ifr_ifru", &self.ifr_ifru) - .finish() - } - } - - impl ::hash::Hash for ifreq { - fn hash(&self, state: &mut H) { - self.ifr_name.hash(state); - self.ifr_ifru.hash(state); - } - } - - impl Eq for __c_anonymous_ifc_ifcu {} - - impl PartialEq for __c_anonymous_ifc_ifcu { - fn eq(&self, other: &__c_anonymous_ifc_ifcu) -> bool { - unsafe { - self.ifcu_buf == other.ifcu_buf && - self.ifcu_req == other.ifcu_req - } - } - } - - impl ::fmt::Debug for __c_anonymous_ifc_ifcu { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ifc_ifcu") - .field("ifcu_buf", unsafe { &self.ifcu_buf }) - .field("ifcu_req", unsafe { &self.ifcu_req }) - .finish() - } - } - - impl ::hash::Hash for __c_anonymous_ifc_ifcu { - fn hash(&self, state: &mut H) { - unsafe { self.ifcu_buf.hash(state) }; - unsafe { self.ifcu_req.hash(state) }; - } - } - } -} - pub const _UTX_USERSIZE: usize = 256; pub const _UTX_LINESIZE: usize = 32; pub const _UTX_IDSIZE: usize = 4; diff --git a/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/src/unix/bsd/freebsdlike/dragonfly/mod.rs index 489b82adb84b9..5b4310cabd459 100644 --- a/src/unix/bsd/freebsdlike/dragonfly/mod.rs +++ b/src/unix/bsd/freebsdlike/dragonfly/mod.rs @@ -45,7 +45,6 @@ pub type vm_map_entry_t = *mut vm_map_entry; pub type pmap = __c_anonymous_pmap; -#[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum sem {} impl ::Copy for sem {} impl ::Clone for sem { @@ -411,9 +410,7 @@ s! { pub data: *mut ::c_void, pub size: ::size_t, } -} -s_no_extra_traits! { pub struct utmpx { pub ut_name: [::c_char; 32], pub ut_id: [::c_char; 4], @@ -531,374 +528,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for utmpx { - fn eq(&self, other: &utmpx) -> bool { - self.ut_name == other.ut_name - && self.ut_id == other.ut_id - && self.ut_line == other.ut_line - && self - .ut_host - .iter() - .zip(other.ut_host.iter()) - .all(|(a,b)| a == b) - && self.ut_unused == other.ut_unused - && self.ut_session == other.ut_session - && self.ut_type == other.ut_type - && self.ut_pid == other.ut_pid - && self.ut_exit == other.ut_exit - && self.ut_ss == other.ut_ss - && self.ut_tv == other.ut_tv - && self.ut_unused2 == other.ut_unused2 - } - } - impl Eq for utmpx {} - impl ::fmt::Debug for utmpx { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("utmpx") - .field("ut_name", &self.ut_name) - .field("ut_id", &self.ut_id) - .field("ut_line", &self.ut_line) - // FIXME: .field("ut_host", &self.ut_host) - .field("ut_unused", &self.ut_unused) - .field("ut_session", &self.ut_session) - .field("ut_type", &self.ut_type) - .field("ut_pid", &self.ut_pid) - .field("ut_exit", &self.ut_exit) - .field("ut_ss", &self.ut_ss) - .field("ut_tv", &self.ut_tv) - .field("ut_unused2", &self.ut_unused2) - .finish() - } - } - impl ::hash::Hash for utmpx { - fn hash(&self, state: &mut H) { - self.ut_name.hash(state); - self.ut_id.hash(state); - self.ut_line.hash(state); - self.ut_host.hash(state); - self.ut_unused.hash(state); - self.ut_session.hash(state); - self.ut_type.hash(state); - self.ut_pid.hash(state); - self.ut_exit.hash(state); - self.ut_ss.hash(state); - self.ut_tv.hash(state); - self.ut_unused2.hash(state); - } - } - impl PartialEq for lastlogx { - fn eq(&self, other: &lastlogx) -> bool { - self.ll_tv == other.ll_tv - && self.ll_line == other.ll_line - && self.ll_host == other.ll_host - && self.ll_ss == other.ll_ss - } - } - impl Eq for lastlogx {} - impl ::fmt::Debug for lastlogx { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("lastlogx") - .field("ll_tv", &self.ll_tv) - .field("ll_line", &self.ll_line) - .field("ll_host", &self.ll_host) - .field("ll_ss", &self.ll_ss) - .finish() - } - } - impl ::hash::Hash for lastlogx { - fn hash(&self, state: &mut H) { - self.ll_tv.hash(state); - self.ll_line.hash(state); - self.ll_host.hash(state); - self.ll_ss.hash(state); - } - } - - impl PartialEq for dirent { - fn eq(&self, other: &dirent) -> bool { - self.d_fileno == other.d_fileno - && self.d_namlen == other.d_namlen - && self.d_type == other.d_type - // Ignore __unused1 - // Ignore __unused2 - && self - .d_name - .iter() - .zip(other.d_name.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for dirent {} - impl ::fmt::Debug for dirent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("dirent") - .field("d_fileno", &self.d_fileno) - .field("d_namlen", &self.d_namlen) - .field("d_type", &self.d_type) - // Ignore __unused1 - // Ignore __unused2 - // FIXME: .field("d_name", &self.d_name) - .finish() - } - } - impl ::hash::Hash for dirent { - fn hash(&self, state: &mut H) { - self.d_fileno.hash(state); - self.d_namlen.hash(state); - self.d_type.hash(state); - // Ignore __unused1 - // Ignore __unused2 - self.d_name.hash(state); - } - } - - impl PartialEq for statfs { - fn eq(&self, other: &statfs) -> bool { - self.f_bsize == other.f_bsize - && self.f_iosize == other.f_iosize - && self.f_blocks == other.f_blocks - && self.f_bfree == other.f_bfree - && self.f_bavail == other.f_bavail - && self.f_files == other.f_files - && self.f_ffree == other.f_ffree - && self.f_fsid == other.f_fsid - && self.f_owner == other.f_owner - && self.f_type == other.f_type - && self.f_flags == other.f_flags - && self.f_syncwrites == other.f_syncwrites - && self.f_asyncwrites == other.f_asyncwrites - && self.f_fstypename == other.f_fstypename - && self - .f_mntonname - .iter() - .zip(other.f_mntonname.iter()) - .all(|(a,b)| a == b) - && self.f_syncreads == other.f_syncreads - && self.f_asyncreads == other.f_asyncreads - && self - .f_mntfromname - .iter() - .zip(other.f_mntfromname.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for statfs {} - impl ::fmt::Debug for statfs { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("statfs") - .field("f_bsize", &self.f_bsize) - .field("f_iosize", &self.f_iosize) - .field("f_blocks", &self.f_blocks) - .field("f_bfree", &self.f_bfree) - .field("f_bavail", &self.f_bavail) - .field("f_files", &self.f_files) - .field("f_ffree", &self.f_ffree) - .field("f_fsid", &self.f_fsid) - .field("f_owner", &self.f_owner) - .field("f_type", &self.f_type) - .field("f_flags", &self.f_flags) - .field("f_syncwrites", &self.f_syncwrites) - .field("f_asyncwrites", &self.f_asyncwrites) - // FIXME: .field("f_mntonname", &self.f_mntonname) - .field("f_syncreads", &self.f_syncreads) - .field("f_asyncreads", &self.f_asyncreads) - // FIXME: .field("f_mntfromname", &self.f_mntfromname) - .finish() - } - } - impl ::hash::Hash for statfs { - fn hash(&self, state: &mut H) { - self.f_bsize.hash(state); - self.f_iosize.hash(state); - self.f_blocks.hash(state); - self.f_bfree.hash(state); - self.f_bavail.hash(state); - self.f_files.hash(state); - self.f_ffree.hash(state); - self.f_fsid.hash(state); - self.f_owner.hash(state); - self.f_type.hash(state); - self.f_flags.hash(state); - self.f_syncwrites.hash(state); - self.f_asyncwrites.hash(state); - self.f_fstypename.hash(state); - self.f_mntonname.hash(state); - self.f_syncreads.hash(state); - self.f_asyncreads.hash(state); - self.f_mntfromname.hash(state); - } - } - - impl PartialEq for sigevent { - fn eq(&self, other: &sigevent) -> bool { - self.sigev_notify == other.sigev_notify - && self.sigev_signo == other.sigev_signo - && self.sigev_value == other.sigev_value - } - } - impl Eq for sigevent {} - impl ::fmt::Debug for sigevent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sigevent") - .field("sigev_notify", &self.sigev_notify) - .field("sigev_signo", &self.sigev_signo) - .field("sigev_value", &self.sigev_value) - .finish() - } - } - impl ::hash::Hash for sigevent { - fn hash(&self, state: &mut H) { - self.sigev_notify.hash(state); - self.sigev_signo.hash(state); - self.sigev_value.hash(state); - } - } - impl PartialEq for mcontext_t { - fn eq(&self, other: &mcontext_t) -> bool { - self.mc_onstack == other.mc_onstack && - self.mc_rdi == other.mc_rdi && - self.mc_rsi == other.mc_rsi && - self.mc_rdx == other.mc_rdx && - self.mc_rcx == other.mc_rcx && - self.mc_r8 == other.mc_r8 && - self.mc_r9 == other.mc_r9 && - self.mc_rax == other.mc_rax && - self.mc_rbx == other.mc_rbx && - self.mc_rbp == other.mc_rbp && - self.mc_r10 == other.mc_r10 && - self.mc_r11 == other.mc_r11 && - self.mc_r12 == other.mc_r12 && - self.mc_r13 == other.mc_r13 && - self.mc_r14 == other.mc_r14 && - self.mc_r15 == other.mc_r15 && - self.mc_xflags == other.mc_xflags && - self.mc_trapno == other.mc_trapno && - self.mc_addr == other.mc_addr && - self.mc_flags == other.mc_flags && - self.mc_err == other.mc_err && - self.mc_rip == other.mc_rip && - self.mc_cs == other.mc_cs && - self.mc_rflags == other.mc_rflags && - self.mc_rsp == other.mc_rsp && - self.mc_ss == other.mc_ss && - self.mc_len == other.mc_len && - self.mc_fpformat == other.mc_fpformat && - self.mc_ownedfp == other.mc_ownedfp && - self.mc_fpregs.iter().zip(other.mc_fpregs.iter()). - all(|(a, b)| a == b) - } - } - impl Eq for mcontext_t {} - impl ::fmt::Debug for mcontext_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("mcontext_t") - .field("mc_onstack", &self.mc_onstack) - .field("mc_rdi", &self.mc_rdi) - .field("mc_rsi", &self.mc_rsi) - .field("mc_rdx", &self.mc_rdx) - .field("mc_rcx", &self.mc_rcx) - .field("mc_r8", &self.mc_r8) - .field("mc_r9", &self.mc_r9) - .field("mc_rax", &self.mc_rax) - .field("mc_rbx", &self.mc_rbx) - .field("mc_rbp", &self.mc_rbp) - .field("mc_r10", &self.mc_r10) - .field("mc_r11", &self.mc_r11) - .field("mc_r12", &self.mc_r12) - .field("mc_r13", &self.mc_r13) - .field("mc_r14", &self.mc_r14) - .field("mc_r15", &self.mc_r15) - .field("mc_xflags", &self.mc_xflags) - .field("mc_trapno", &self.mc_trapno) - .field("mc_addr", &self.mc_addr) - .field("mc_flags", &self.mc_flags) - .field("mc_err", &self.mc_err) - .field("mc_rip", &self.mc_rip) - .field("mc_cs", &self.mc_cs) - .field("mc_rflags", &self.mc_rflags) - .field("mc_rsp", &self.mc_rsp) - .field("mc_ss", &self.mc_ss) - .field("mc_len", &self.mc_len) - .field("mc_fpformat", &self.mc_fpformat) - .field("mc_ownedfp", &self.mc_ownedfp) - .field("mc_fpregs", &self.mc_fpregs) - .finish() - } - } - impl ::hash::Hash for mcontext_t { - fn hash(&self, state: &mut H) { - self.mc_onstack.hash(state); - self.mc_rdi.hash(state); - self.mc_rsi.hash(state); - self.mc_rdx.hash(state); - self.mc_rcx.hash(state); - self.mc_r8.hash(state); - self.mc_r9.hash(state); - self.mc_rax.hash(state); - self.mc_rbx.hash(state); - self.mc_rbp.hash(state); - self.mc_r10.hash(state); - self.mc_r11.hash(state); - self.mc_r10.hash(state); - self.mc_r11.hash(state); - self.mc_r12.hash(state); - self.mc_r13.hash(state); - self.mc_r14.hash(state); - self.mc_r15.hash(state); - self.mc_xflags.hash(state); - self.mc_trapno.hash(state); - self.mc_addr.hash(state); - self.mc_flags.hash(state); - self.mc_err.hash(state); - self.mc_rip.hash(state); - self.mc_cs.hash(state); - self.mc_rflags.hash(state); - self.mc_rsp.hash(state); - self.mc_ss.hash(state); - self.mc_len.hash(state); - self.mc_fpformat.hash(state); - self.mc_ownedfp.hash(state); - self.mc_fpregs.hash(state); - } - } - impl PartialEq for ucontext_t { - fn eq(&self, other: &ucontext_t) -> bool { - self.uc_sigmask == other.uc_sigmask - && self.uc_mcontext == other.uc_mcontext - && self.uc_link == other.uc_link - && self.uc_stack == other.uc_stack - && self.uc_cofunc == other.uc_cofunc - && self.uc_arg == other.uc_arg - } - } - impl Eq for ucontext_t {} - impl ::fmt::Debug for ucontext_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ucontext_t") - .field("uc_sigmask", &self.uc_sigmask) - .field("uc_mcontext", &self.uc_mcontext) - .field("uc_link", &self.uc_link) - .field("uc_stack", &self.uc_stack) - .field("uc_cofunc", &self.uc_cofunc) - .field("uc_arg", &self.uc_arg) - .finish() - } - } - impl ::hash::Hash for ucontext_t { - fn hash(&self, state: &mut H) { - self.uc_sigmask.hash(state); - self.uc_mcontext.hash(state); - self.uc_link.hash(state); - self.uc_stack.hash(state); - self.uc_cofunc.hash(state); - self.uc_arg.hash(state); - } - } - } -} - pub const RAND_MAX: ::c_int = 0x7fff_ffff; pub const PTHREAD_STACK_MIN: ::size_t = 16384; pub const SIGSTKSZ: ::size_t = 40960; diff --git a/src/unix/bsd/freebsdlike/freebsd/aarch64.rs b/src/unix/bsd/freebsdlike/freebsd/aarch64.rs index d240eb001ad5d..ee5c08e5d9d16 100644 --- a/src/unix/bsd/freebsdlike/freebsd/aarch64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/aarch64.rs @@ -6,7 +6,7 @@ pub type time_t = i64; pub type suseconds_t = i64; pub type register_t = i64; -s_no_extra_traits! { +s! { pub struct gpregs { pub gp_x: [::register_t; 30], pub gp_lr: ::register_t, @@ -35,103 +35,5 @@ s_no_extra_traits! { pub(crate) const _ALIGNBYTES: usize = ::mem::size_of::<::c_longlong>() - 1; -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for gpregs { - fn eq(&self, other: &gpregs) -> bool { - self.gp_x.iter().zip(other.gp_x.iter()).all(|(a, b)| a == b) && - self.gp_lr == other.gp_lr && - self.gp_sp == other.gp_sp && - self.gp_elr == other.gp_elr && - self.gp_spsr == other.gp_spsr && - self.gp_pad == other.gp_pad - } - } - impl Eq for gpregs {} - impl ::fmt::Debug for gpregs { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("gpregs") - .field("gp_x", &self.gp_x) - .field("gp_lr", &self.gp_lr) - .field("gp_sp", &self.gp_sp) - .field("gp_elr", &self.gp_elr) - .field("gp_spsr", &self.gp_spsr) - .field("gp_pad", &self.gp_pad) - .finish() - } - } - impl ::hash::Hash for gpregs { - fn hash(&self, state: &mut H) { - self.gp_x.hash(state); - self.gp_lr.hash(state); - self.gp_sp.hash(state); - self.gp_elr.hash(state); - self.gp_spsr.hash(state); - self.gp_pad.hash(state); - } - } - impl PartialEq for fpregs { - fn eq(&self, other: &fpregs) -> bool { - self.fp_q == other.fp_q && - self.fp_sr == other.fp_sr && - self.fp_cr == other.fp_cr && - self.fp_flags == other.fp_flags && - self.fp_pad == other.fp_pad - } - } - impl Eq for fpregs {} - impl ::fmt::Debug for fpregs { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("fpregs") - .field("fp_q", &self.fp_q) - .field("fp_sr", &self.fp_sr) - .field("fp_cr", &self.fp_cr) - .field("fp_flags", &self.fp_flags) - .field("fp_pad", &self.fp_pad) - .finish() - } - } - impl ::hash::Hash for fpregs { - fn hash(&self, state: &mut H) { - self.fp_q.hash(state); - self.fp_sr.hash(state); - self.fp_cr.hash(state); - self.fp_flags.hash(state); - self.fp_pad.hash(state); - } - } - impl PartialEq for mcontext_t { - fn eq(&self, other: &mcontext_t) -> bool { - self.mc_gpregs == other.mc_gpregs && - self.mc_fpregs == other.mc_fpregs && - self.mc_flags == other.mc_flags && - self.mc_pad == other.mc_pad && - self.mc_spare.iter().zip(other.mc_spare.iter()).all(|(a, b)| a == b) - } - } - impl Eq for mcontext_t {} - impl ::fmt::Debug for mcontext_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("mcontext_t") - .field("mc_gpregs", &self.mc_gpregs) - .field("mc_fpregs", &self.mc_fpregs) - .field("mc_flags", &self.mc_flags) - .field("mc_pad", &self.mc_pad) - .field("mc_spare", &self.mc_spare) - .finish() - } - } - impl ::hash::Hash for mcontext_t { - fn hash(&self, state: &mut H) { - self.mc_gpregs.hash(state); - self.mc_fpregs.hash(state); - self.mc_flags.hash(state); - self.mc_pad.hash(state); - self.mc_spare.hash(state); - } - } - } -} - pub const MAP_32BIT: ::c_int = 0x00080000; pub const MINSIGSTKSZ: ::size_t = 4096; // 1024 * 4 diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd11/b64.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd11/b64.rs index f32128f775574..57074b23ba72f 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd11/b64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd11/b64.rs @@ -1,5 +1,4 @@ #[repr(C)] -#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))] pub struct stat { pub st_dev: ::dev_t, pub st_ino: ::ino_t, diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs index de34069eabdf2..3e6b39a48069c 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs @@ -209,9 +209,7 @@ s! { /// kthread flag. pub ki_tdflags: ::c_long, } -} -s_no_extra_traits! { pub struct dirent { pub d_fileno: ::ino_t, pub d_reclen: u16, @@ -260,173 +258,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for statfs { - fn eq(&self, other: &statfs) -> bool { - self.f_version == other.f_version - && self.f_type == other.f_type - && self.f_flags == other.f_flags - && self.f_bsize == other.f_bsize - && self.f_iosize == other.f_iosize - && self.f_blocks == other.f_blocks - && self.f_bfree == other.f_bfree - && self.f_bavail == other.f_bavail - && self.f_files == other.f_files - && self.f_ffree == other.f_ffree - && self.f_syncwrites == other.f_syncwrites - && self.f_asyncwrites == other.f_asyncwrites - && self.f_syncreads == other.f_syncreads - && self.f_asyncreads == other.f_asyncreads - && self.f_namemax == other.f_namemax - && self.f_owner == other.f_owner - && self.f_fsid == other.f_fsid - && self.f_fstypename == other.f_fstypename - && self - .f_mntfromname - .iter() - .zip(other.f_mntfromname.iter()) - .all(|(a,b)| a == b) - && self - .f_mntonname - .iter() - .zip(other.f_mntonname.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for statfs {} - impl ::fmt::Debug for statfs { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("statfs") - .field("f_bsize", &self.f_bsize) - .field("f_iosize", &self.f_iosize) - .field("f_blocks", &self.f_blocks) - .field("f_bfree", &self.f_bfree) - .field("f_bavail", &self.f_bavail) - .field("f_files", &self.f_files) - .field("f_ffree", &self.f_ffree) - .field("f_syncwrites", &self.f_syncwrites) - .field("f_asyncwrites", &self.f_asyncwrites) - .field("f_syncreads", &self.f_syncreads) - .field("f_asyncreads", &self.f_asyncreads) - .field("f_namemax", &self.f_namemax) - .field("f_owner", &self.f_owner) - .field("f_fsid", &self.f_fsid) - .field("f_fstypename", &self.f_fstypename) - .field("f_mntfromname", &&self.f_mntfromname[..]) - .field("f_mntonname", &&self.f_mntonname[..]) - .finish() - } - } - impl ::hash::Hash for statfs { - fn hash(&self, state: &mut H) { - self.f_version.hash(state); - self.f_type.hash(state); - self.f_flags.hash(state); - self.f_bsize.hash(state); - self.f_iosize.hash(state); - self.f_blocks.hash(state); - self.f_bfree.hash(state); - self.f_bavail.hash(state); - self.f_files.hash(state); - self.f_ffree.hash(state); - self.f_syncwrites.hash(state); - self.f_asyncwrites.hash(state); - self.f_syncreads.hash(state); - self.f_asyncreads.hash(state); - self.f_namemax.hash(state); - self.f_owner.hash(state); - self.f_fsid.hash(state); - self.f_fstypename.hash(state); - self.f_mntfromname.hash(state); - self.f_mntonname.hash(state); - } - } - - impl PartialEq for dirent { - fn eq(&self, other: &dirent) -> bool { - self.d_fileno == other.d_fileno - && self.d_reclen == other.d_reclen - && self.d_type == other.d_type - && self.d_namlen == other.d_namlen - && self - .d_name[..self.d_namlen as _] - .iter() - .zip(other.d_name.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for dirent {} - impl ::fmt::Debug for dirent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("dirent") - .field("d_fileno", &self.d_fileno) - .field("d_reclen", &self.d_reclen) - .field("d_type", &self.d_type) - .field("d_namlen", &self.d_namlen) - .field("d_name", &&self.d_name[..self.d_namlen as _]) - .finish() - } - } - impl ::hash::Hash for dirent { - fn hash(&self, state: &mut H) { - self.d_fileno.hash(state); - self.d_reclen.hash(state); - self.d_type.hash(state); - self.d_namlen.hash(state); - self.d_name[..self.d_namlen as _].hash(state); - } - } - - impl PartialEq for vnstat { - fn eq(&self, other: &vnstat) -> bool { - let self_vn_devname: &[::c_char] = &self.vn_devname; - let other_vn_devname: &[::c_char] = &other.vn_devname; - - self.vn_fileid == other.vn_fileid && - self.vn_size == other.vn_size && - self.vn_mntdir == other.vn_mntdir && - self.vn_dev == other.vn_dev && - self.vn_fsid == other.vn_fsid && - self.vn_type == other.vn_type && - self.vn_mode == other.vn_mode && - self_vn_devname == other_vn_devname - } - } - impl Eq for vnstat {} - impl ::fmt::Debug for vnstat { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let self_vn_devname: &[::c_char] = &self.vn_devname; - - f.debug_struct("vnstat") - .field("vn_fileid", &self.vn_fileid) - .field("vn_size", &self.vn_size) - .field("vn_mntdir", &self.vn_mntdir) - .field("vn_dev", &self.vn_dev) - .field("vn_fsid", &self.vn_fsid) - .field("vn_type", &self.vn_type) - .field("vn_mode", &self.vn_mode) - .field("vn_devname", &self_vn_devname) - .finish() - } - } - impl ::hash::Hash for vnstat { - fn hash(&self, state: &mut H) { - let self_vn_devname: &[::c_char] = &self.vn_devname; - - self.vn_fileid.hash(state); - self.vn_size.hash(state); - self.vn_mntdir.hash(state); - self.vn_dev.hash(state); - self.vn_fsid.hash(state); - self.vn_type.hash(state); - self.vn_mode.hash(state); - self_vn_devname.hash(state); - } - } - } -} - pub const ELAST: ::c_int = 96; pub const RAND_MAX: ::c_int = 0x7fff_fffd; pub const KI_NSPARE_PTR: usize = 6; diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd12/b64.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd12/b64.rs index 80c6fa1684530..0222e76a8f45d 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd12/b64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd12/b64.rs @@ -1,5 +1,4 @@ #[repr(C)] -#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))] pub struct stat { pub st_dev: ::dev_t, pub st_ino: ::ino_t, diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs index 10fcaa03a4ef6..dd9084a01150c 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs @@ -218,9 +218,7 @@ s! { /// kthread flag. pub ki_tdflags: ::c_long, } -} -s_no_extra_traits! { pub struct dirent { pub d_fileno: ::ino_t, pub d_off: ::off_t, @@ -269,177 +267,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for statfs { - fn eq(&self, other: &statfs) -> bool { - self.f_version == other.f_version - && self.f_type == other.f_type - && self.f_flags == other.f_flags - && self.f_bsize == other.f_bsize - && self.f_iosize == other.f_iosize - && self.f_blocks == other.f_blocks - && self.f_bfree == other.f_bfree - && self.f_bavail == other.f_bavail - && self.f_files == other.f_files - && self.f_ffree == other.f_ffree - && self.f_syncwrites == other.f_syncwrites - && self.f_asyncwrites == other.f_asyncwrites - && self.f_syncreads == other.f_syncreads - && self.f_asyncreads == other.f_asyncreads - && self.f_namemax == other.f_namemax - && self.f_owner == other.f_owner - && self.f_fsid == other.f_fsid - && self.f_fstypename == other.f_fstypename - && self - .f_mntfromname - .iter() - .zip(other.f_mntfromname.iter()) - .all(|(a,b)| a == b) - && self - .f_mntonname - .iter() - .zip(other.f_mntonname.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for statfs {} - impl ::fmt::Debug for statfs { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("statfs") - .field("f_bsize", &self.f_bsize) - .field("f_iosize", &self.f_iosize) - .field("f_blocks", &self.f_blocks) - .field("f_bfree", &self.f_bfree) - .field("f_bavail", &self.f_bavail) - .field("f_files", &self.f_files) - .field("f_ffree", &self.f_ffree) - .field("f_syncwrites", &self.f_syncwrites) - .field("f_asyncwrites", &self.f_asyncwrites) - .field("f_syncreads", &self.f_syncreads) - .field("f_asyncreads", &self.f_asyncreads) - .field("f_namemax", &self.f_namemax) - .field("f_owner", &self.f_owner) - .field("f_fsid", &self.f_fsid) - .field("f_fstypename", &self.f_fstypename) - .field("f_mntfromname", &&self.f_mntfromname[..]) - .field("f_mntonname", &&self.f_mntonname[..]) - .finish() - } - } - impl ::hash::Hash for statfs { - fn hash(&self, state: &mut H) { - self.f_version.hash(state); - self.f_type.hash(state); - self.f_flags.hash(state); - self.f_bsize.hash(state); - self.f_iosize.hash(state); - self.f_blocks.hash(state); - self.f_bfree.hash(state); - self.f_bavail.hash(state); - self.f_files.hash(state); - self.f_ffree.hash(state); - self.f_syncwrites.hash(state); - self.f_asyncwrites.hash(state); - self.f_syncreads.hash(state); - self.f_asyncreads.hash(state); - self.f_namemax.hash(state); - self.f_owner.hash(state); - self.f_fsid.hash(state); - self.f_charspare.hash(state); - self.f_fstypename.hash(state); - self.f_mntfromname.hash(state); - self.f_mntonname.hash(state); - } - } - - impl PartialEq for dirent { - fn eq(&self, other: &dirent) -> bool { - self.d_fileno == other.d_fileno - && self.d_off == other.d_off - && self.d_reclen == other.d_reclen - && self.d_type == other.d_type - && self.d_namlen == other.d_namlen - && self - .d_name[..self.d_namlen as _] - .iter() - .zip(other.d_name.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for dirent {} - impl ::fmt::Debug for dirent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("dirent") - .field("d_fileno", &self.d_fileno) - .field("d_off", &self.d_off) - .field("d_reclen", &self.d_reclen) - .field("d_type", &self.d_type) - .field("d_namlen", &self.d_namlen) - .field("d_name", &&self.d_name[..self.d_namlen as _]) - .finish() - } - } - impl ::hash::Hash for dirent { - fn hash(&self, state: &mut H) { - self.d_fileno.hash(state); - self.d_off.hash(state); - self.d_reclen.hash(state); - self.d_type.hash(state); - self.d_namlen.hash(state); - self.d_name[..self.d_namlen as _].hash(state); - } - } - - impl PartialEq for vnstat { - fn eq(&self, other: &vnstat) -> bool { - let self_vn_devname: &[::c_char] = &self.vn_devname; - let other_vn_devname: &[::c_char] = &other.vn_devname; - - self.vn_fileid == other.vn_fileid && - self.vn_size == other.vn_size && - self.vn_dev == other.vn_dev && - self.vn_fsid == other.vn_fsid && - self.vn_mntdir == other.vn_mntdir && - self.vn_type == other.vn_type && - self.vn_mode == other.vn_mode && - self_vn_devname == other_vn_devname - } - } - impl Eq for vnstat {} - impl ::fmt::Debug for vnstat { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let self_vn_devname: &[::c_char] = &self.vn_devname; - - f.debug_struct("vnstat") - .field("vn_fileid", &self.vn_fileid) - .field("vn_size", &self.vn_size) - .field("vn_dev", &self.vn_dev) - .field("vn_fsid", &self.vn_fsid) - .field("vn_mntdir", &self.vn_mntdir) - .field("vn_type", &self.vn_type) - .field("vn_mode", &self.vn_mode) - .field("vn_devname", &self_vn_devname) - .finish() - } - } - impl ::hash::Hash for vnstat { - fn hash(&self, state: &mut H) { - let self_vn_devname: &[::c_char] = &self.vn_devname; - - self.vn_fileid.hash(state); - self.vn_size.hash(state); - self.vn_dev.hash(state); - self.vn_fsid.hash(state); - self.vn_mntdir.hash(state); - self.vn_type.hash(state); - self.vn_mode.hash(state); - self_vn_devname.hash(state); - } - } - } -} - pub const RAND_MAX: ::c_int = 0x7fff_fffd; pub const ELAST: ::c_int = 97; diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd13/b64.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd13/b64.rs index 80c6fa1684530..0222e76a8f45d 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd13/b64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd13/b64.rs @@ -1,5 +1,4 @@ #[repr(C)] -#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))] pub struct stat { pub st_dev: ::dev_t, pub st_ino: ::ino_t, diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs index ec6bce2a03091..20b25498a4a5a 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs @@ -228,9 +228,7 @@ s! { /// kthread flag. pub ki_tdflags: ::c_long, } -} -s_no_extra_traits! { pub struct dirent { pub d_fileno: ::ino_t, pub d_off: ::off_t, @@ -279,177 +277,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for statfs { - fn eq(&self, other: &statfs) -> bool { - self.f_version == other.f_version - && self.f_type == other.f_type - && self.f_flags == other.f_flags - && self.f_bsize == other.f_bsize - && self.f_iosize == other.f_iosize - && self.f_blocks == other.f_blocks - && self.f_bfree == other.f_bfree - && self.f_bavail == other.f_bavail - && self.f_files == other.f_files - && self.f_ffree == other.f_ffree - && self.f_syncwrites == other.f_syncwrites - && self.f_asyncwrites == other.f_asyncwrites - && self.f_syncreads == other.f_syncreads - && self.f_asyncreads == other.f_asyncreads - && self.f_namemax == other.f_namemax - && self.f_owner == other.f_owner - && self.f_fsid == other.f_fsid - && self.f_fstypename == other.f_fstypename - && self - .f_mntfromname - .iter() - .zip(other.f_mntfromname.iter()) - .all(|(a,b)| a == b) - && self - .f_mntonname - .iter() - .zip(other.f_mntonname.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for statfs {} - impl ::fmt::Debug for statfs { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("statfs") - .field("f_bsize", &self.f_bsize) - .field("f_iosize", &self.f_iosize) - .field("f_blocks", &self.f_blocks) - .field("f_bfree", &self.f_bfree) - .field("f_bavail", &self.f_bavail) - .field("f_files", &self.f_files) - .field("f_ffree", &self.f_ffree) - .field("f_syncwrites", &self.f_syncwrites) - .field("f_asyncwrites", &self.f_asyncwrites) - .field("f_syncreads", &self.f_syncreads) - .field("f_asyncreads", &self.f_asyncreads) - .field("f_namemax", &self.f_namemax) - .field("f_owner", &self.f_owner) - .field("f_fsid", &self.f_fsid) - .field("f_fstypename", &self.f_fstypename) - .field("f_mntfromname", &&self.f_mntfromname[..]) - .field("f_mntonname", &&self.f_mntonname[..]) - .finish() - } - } - impl ::hash::Hash for statfs { - fn hash(&self, state: &mut H) { - self.f_version.hash(state); - self.f_type.hash(state); - self.f_flags.hash(state); - self.f_bsize.hash(state); - self.f_iosize.hash(state); - self.f_blocks.hash(state); - self.f_bfree.hash(state); - self.f_bavail.hash(state); - self.f_files.hash(state); - self.f_ffree.hash(state); - self.f_syncwrites.hash(state); - self.f_asyncwrites.hash(state); - self.f_syncreads.hash(state); - self.f_asyncreads.hash(state); - self.f_namemax.hash(state); - self.f_owner.hash(state); - self.f_fsid.hash(state); - self.f_charspare.hash(state); - self.f_fstypename.hash(state); - self.f_mntfromname.hash(state); - self.f_mntonname.hash(state); - } - } - - impl PartialEq for dirent { - fn eq(&self, other: &dirent) -> bool { - self.d_fileno == other.d_fileno - && self.d_off == other.d_off - && self.d_reclen == other.d_reclen - && self.d_type == other.d_type - && self.d_namlen == other.d_namlen - && self - .d_name[..self.d_namlen as _] - .iter() - .zip(other.d_name.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for dirent {} - impl ::fmt::Debug for dirent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("dirent") - .field("d_fileno", &self.d_fileno) - .field("d_off", &self.d_off) - .field("d_reclen", &self.d_reclen) - .field("d_type", &self.d_type) - .field("d_namlen", &self.d_namlen) - .field("d_name", &&self.d_name[..self.d_namlen as _]) - .finish() - } - } - impl ::hash::Hash for dirent { - fn hash(&self, state: &mut H) { - self.d_fileno.hash(state); - self.d_off.hash(state); - self.d_reclen.hash(state); - self.d_type.hash(state); - self.d_namlen.hash(state); - self.d_name[..self.d_namlen as _].hash(state); - } - } - - impl PartialEq for vnstat { - fn eq(&self, other: &vnstat) -> bool { - let self_vn_devname: &[::c_char] = &self.vn_devname; - let other_vn_devname: &[::c_char] = &other.vn_devname; - - self.vn_fileid == other.vn_fileid && - self.vn_size == other.vn_size && - self.vn_dev == other.vn_dev && - self.vn_fsid == other.vn_fsid && - self.vn_mntdir == other.vn_mntdir && - self.vn_type == other.vn_type && - self.vn_mode == other.vn_mode && - self_vn_devname == other_vn_devname - } - } - impl Eq for vnstat {} - impl ::fmt::Debug for vnstat { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let self_vn_devname: &[::c_char] = &self.vn_devname; - - f.debug_struct("vnstat") - .field("vn_fileid", &self.vn_fileid) - .field("vn_size", &self.vn_size) - .field("vn_dev", &self.vn_dev) - .field("vn_fsid", &self.vn_fsid) - .field("vn_mntdir", &self.vn_mntdir) - .field("vn_type", &self.vn_type) - .field("vn_mode", &self.vn_mode) - .field("vn_devname", &self_vn_devname) - .finish() - } - } - impl ::hash::Hash for vnstat { - fn hash(&self, state: &mut H) { - let self_vn_devname: &[::c_char] = &self.vn_devname; - - self.vn_fileid.hash(state); - self.vn_size.hash(state); - self.vn_dev.hash(state); - self.vn_fsid.hash(state); - self.vn_mntdir.hash(state); - self.vn_type.hash(state); - self.vn_mode.hash(state); - self_vn_devname.hash(state); - } - } - } -} - pub const RAND_MAX: ::c_int = 0x7fff_ffff; pub const ELAST: ::c_int = 97; diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd14/b64.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd14/b64.rs index 80c6fa1684530..0222e76a8f45d 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd14/b64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd14/b64.rs @@ -1,5 +1,4 @@ #[repr(C)] -#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))] pub struct stat { pub st_dev: ::dev_t, pub st_ino: ::ino_t, diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs index 160a4baae481b..4166eedab4311 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs @@ -228,9 +228,7 @@ s! { /// kthread flag. pub ki_tdflags: ::c_long, } -} -s_no_extra_traits! { pub struct dirent { pub d_fileno: ::ino_t, pub d_off: ::off_t, @@ -279,177 +277,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for statfs { - fn eq(&self, other: &statfs) -> bool { - self.f_version == other.f_version - && self.f_type == other.f_type - && self.f_flags == other.f_flags - && self.f_bsize == other.f_bsize - && self.f_iosize == other.f_iosize - && self.f_blocks == other.f_blocks - && self.f_bfree == other.f_bfree - && self.f_bavail == other.f_bavail - && self.f_files == other.f_files - && self.f_ffree == other.f_ffree - && self.f_syncwrites == other.f_syncwrites - && self.f_asyncwrites == other.f_asyncwrites - && self.f_syncreads == other.f_syncreads - && self.f_asyncreads == other.f_asyncreads - && self.f_namemax == other.f_namemax - && self.f_owner == other.f_owner - && self.f_fsid == other.f_fsid - && self.f_fstypename == other.f_fstypename - && self - .f_mntfromname - .iter() - .zip(other.f_mntfromname.iter()) - .all(|(a,b)| a == b) - && self - .f_mntonname - .iter() - .zip(other.f_mntonname.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for statfs {} - impl ::fmt::Debug for statfs { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("statfs") - .field("f_bsize", &self.f_bsize) - .field("f_iosize", &self.f_iosize) - .field("f_blocks", &self.f_blocks) - .field("f_bfree", &self.f_bfree) - .field("f_bavail", &self.f_bavail) - .field("f_files", &self.f_files) - .field("f_ffree", &self.f_ffree) - .field("f_syncwrites", &self.f_syncwrites) - .field("f_asyncwrites", &self.f_asyncwrites) - .field("f_syncreads", &self.f_syncreads) - .field("f_asyncreads", &self.f_asyncreads) - .field("f_namemax", &self.f_namemax) - .field("f_owner", &self.f_owner) - .field("f_fsid", &self.f_fsid) - .field("f_fstypename", &self.f_fstypename) - .field("f_mntfromname", &&self.f_mntfromname[..]) - .field("f_mntonname", &&self.f_mntonname[..]) - .finish() - } - } - impl ::hash::Hash for statfs { - fn hash(&self, state: &mut H) { - self.f_version.hash(state); - self.f_type.hash(state); - self.f_flags.hash(state); - self.f_bsize.hash(state); - self.f_iosize.hash(state); - self.f_blocks.hash(state); - self.f_bfree.hash(state); - self.f_bavail.hash(state); - self.f_files.hash(state); - self.f_ffree.hash(state); - self.f_syncwrites.hash(state); - self.f_asyncwrites.hash(state); - self.f_syncreads.hash(state); - self.f_asyncreads.hash(state); - self.f_namemax.hash(state); - self.f_owner.hash(state); - self.f_fsid.hash(state); - self.f_charspare.hash(state); - self.f_fstypename.hash(state); - self.f_mntfromname.hash(state); - self.f_mntonname.hash(state); - } - } - - impl PartialEq for dirent { - fn eq(&self, other: &dirent) -> bool { - self.d_fileno == other.d_fileno - && self.d_off == other.d_off - && self.d_reclen == other.d_reclen - && self.d_type == other.d_type - && self.d_namlen == other.d_namlen - && self - .d_name[..self.d_namlen as _] - .iter() - .zip(other.d_name.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for dirent {} - impl ::fmt::Debug for dirent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("dirent") - .field("d_fileno", &self.d_fileno) - .field("d_off", &self.d_off) - .field("d_reclen", &self.d_reclen) - .field("d_type", &self.d_type) - .field("d_namlen", &self.d_namlen) - .field("d_name", &&self.d_name[..self.d_namlen as _]) - .finish() - } - } - impl ::hash::Hash for dirent { - fn hash(&self, state: &mut H) { - self.d_fileno.hash(state); - self.d_off.hash(state); - self.d_reclen.hash(state); - self.d_type.hash(state); - self.d_namlen.hash(state); - self.d_name[..self.d_namlen as _].hash(state); - } - } - - impl PartialEq for vnstat { - fn eq(&self, other: &vnstat) -> bool { - let self_vn_devname: &[::c_char] = &self.vn_devname; - let other_vn_devname: &[::c_char] = &other.vn_devname; - - self.vn_fileid == other.vn_fileid && - self.vn_size == other.vn_size && - self.vn_dev == other.vn_dev && - self.vn_fsid == other.vn_fsid && - self.vn_mntdir == other.vn_mntdir && - self.vn_type == other.vn_type && - self.vn_mode == other.vn_mode && - self_vn_devname == other_vn_devname - } - } - impl Eq for vnstat {} - impl ::fmt::Debug for vnstat { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let self_vn_devname: &[::c_char] = &self.vn_devname; - - f.debug_struct("vnstat") - .field("vn_fileid", &self.vn_fileid) - .field("vn_size", &self.vn_size) - .field("vn_dev", &self.vn_dev) - .field("vn_fsid", &self.vn_fsid) - .field("vn_mntdir", &self.vn_mntdir) - .field("vn_type", &self.vn_type) - .field("vn_mode", &self.vn_mode) - .field("vn_devname", &self_vn_devname) - .finish() - } - } - impl ::hash::Hash for vnstat { - fn hash(&self, state: &mut H) { - let self_vn_devname: &[::c_char] = &self.vn_devname; - - self.vn_fileid.hash(state); - self.vn_size.hash(state); - self.vn_dev.hash(state); - self.vn_fsid.hash(state); - self.vn_mntdir.hash(state); - self.vn_type.hash(state); - self.vn_mode.hash(state); - self_vn_devname.hash(state); - } - } - } -} - pub const RAND_MAX: ::c_int = 0x7fff_ffff; pub const ELAST: ::c_int = 97; diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd15/b64.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd15/b64.rs index 80c6fa1684530..0222e76a8f45d 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd15/b64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd15/b64.rs @@ -1,5 +1,4 @@ #[repr(C)] -#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))] pub struct stat { pub st_dev: ::dev_t, pub st_ino: ::ino_t, diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs index d73215a68ec33..a5dca1eac94fb 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs @@ -228,9 +228,7 @@ s! { /// kthread flag. pub ki_tdflags: ::c_long, } -} -s_no_extra_traits! { pub struct dirent { pub d_fileno: ::ino_t, pub d_off: ::off_t, @@ -279,177 +277,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for statfs { - fn eq(&self, other: &statfs) -> bool { - self.f_version == other.f_version - && self.f_type == other.f_type - && self.f_flags == other.f_flags - && self.f_bsize == other.f_bsize - && self.f_iosize == other.f_iosize - && self.f_blocks == other.f_blocks - && self.f_bfree == other.f_bfree - && self.f_bavail == other.f_bavail - && self.f_files == other.f_files - && self.f_ffree == other.f_ffree - && self.f_syncwrites == other.f_syncwrites - && self.f_asyncwrites == other.f_asyncwrites - && self.f_syncreads == other.f_syncreads - && self.f_asyncreads == other.f_asyncreads - && self.f_namemax == other.f_namemax - && self.f_owner == other.f_owner - && self.f_fsid == other.f_fsid - && self.f_fstypename == other.f_fstypename - && self - .f_mntfromname - .iter() - .zip(other.f_mntfromname.iter()) - .all(|(a,b)| a == b) - && self - .f_mntonname - .iter() - .zip(other.f_mntonname.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for statfs {} - impl ::fmt::Debug for statfs { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("statfs") - .field("f_bsize", &self.f_bsize) - .field("f_iosize", &self.f_iosize) - .field("f_blocks", &self.f_blocks) - .field("f_bfree", &self.f_bfree) - .field("f_bavail", &self.f_bavail) - .field("f_files", &self.f_files) - .field("f_ffree", &self.f_ffree) - .field("f_syncwrites", &self.f_syncwrites) - .field("f_asyncwrites", &self.f_asyncwrites) - .field("f_syncreads", &self.f_syncreads) - .field("f_asyncreads", &self.f_asyncreads) - .field("f_namemax", &self.f_namemax) - .field("f_owner", &self.f_owner) - .field("f_fsid", &self.f_fsid) - .field("f_fstypename", &self.f_fstypename) - .field("f_mntfromname", &&self.f_mntfromname[..]) - .field("f_mntonname", &&self.f_mntonname[..]) - .finish() - } - } - impl ::hash::Hash for statfs { - fn hash(&self, state: &mut H) { - self.f_version.hash(state); - self.f_type.hash(state); - self.f_flags.hash(state); - self.f_bsize.hash(state); - self.f_iosize.hash(state); - self.f_blocks.hash(state); - self.f_bfree.hash(state); - self.f_bavail.hash(state); - self.f_files.hash(state); - self.f_ffree.hash(state); - self.f_syncwrites.hash(state); - self.f_asyncwrites.hash(state); - self.f_syncreads.hash(state); - self.f_asyncreads.hash(state); - self.f_namemax.hash(state); - self.f_owner.hash(state); - self.f_fsid.hash(state); - self.f_charspare.hash(state); - self.f_fstypename.hash(state); - self.f_mntfromname.hash(state); - self.f_mntonname.hash(state); - } - } - - impl PartialEq for dirent { - fn eq(&self, other: &dirent) -> bool { - self.d_fileno == other.d_fileno - && self.d_off == other.d_off - && self.d_reclen == other.d_reclen - && self.d_type == other.d_type - && self.d_namlen == other.d_namlen - && self - .d_name[..self.d_namlen as _] - .iter() - .zip(other.d_name.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for dirent {} - impl ::fmt::Debug for dirent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("dirent") - .field("d_fileno", &self.d_fileno) - .field("d_off", &self.d_off) - .field("d_reclen", &self.d_reclen) - .field("d_type", &self.d_type) - .field("d_namlen", &self.d_namlen) - .field("d_name", &&self.d_name[..self.d_namlen as _]) - .finish() - } - } - impl ::hash::Hash for dirent { - fn hash(&self, state: &mut H) { - self.d_fileno.hash(state); - self.d_off.hash(state); - self.d_reclen.hash(state); - self.d_type.hash(state); - self.d_namlen.hash(state); - self.d_name[..self.d_namlen as _].hash(state); - } - } - - impl PartialEq for vnstat { - fn eq(&self, other: &vnstat) -> bool { - let self_vn_devname: &[::c_char] = &self.vn_devname; - let other_vn_devname: &[::c_char] = &other.vn_devname; - - self.vn_fileid == other.vn_fileid && - self.vn_size == other.vn_size && - self.vn_dev == other.vn_dev && - self.vn_fsid == other.vn_fsid && - self.vn_mntdir == other.vn_mntdir && - self.vn_type == other.vn_type && - self.vn_mode == other.vn_mode && - self_vn_devname == other_vn_devname - } - } - impl Eq for vnstat {} - impl ::fmt::Debug for vnstat { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let self_vn_devname: &[::c_char] = &self.vn_devname; - - f.debug_struct("vnstat") - .field("vn_fileid", &self.vn_fileid) - .field("vn_size", &self.vn_size) - .field("vn_dev", &self.vn_dev) - .field("vn_fsid", &self.vn_fsid) - .field("vn_mntdir", &self.vn_mntdir) - .field("vn_type", &self.vn_type) - .field("vn_mode", &self.vn_mode) - .field("vn_devname", &self_vn_devname) - .finish() - } - } - impl ::hash::Hash for vnstat { - fn hash(&self, state: &mut H) { - let self_vn_devname: &[::c_char] = &self.vn_devname; - - self.vn_fileid.hash(state); - self.vn_size.hash(state); - self.vn_dev.hash(state); - self.vn_fsid.hash(state); - self.vn_mntdir.hash(state); - self.vn_type.hash(state); - self.vn_mode.hash(state); - self_vn_devname.hash(state); - } - } - } -} - pub const RAND_MAX: ::c_int = 0x7fff_ffff; pub const ELAST: ::c_int = 97; diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 389b386bc88ad..7f364102ff991 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -50,7 +50,6 @@ pub type sctp_assoc_t = u32; pub type eventfd_t = u64; -#[cfg_attr(feature = "extra_traits", derive(Debug, Hash, PartialEq, Eq))] #[repr(u32)] pub enum devstat_support_flags { DEVSTAT_ALL_SUPPORTED = 0x00, @@ -65,7 +64,6 @@ impl ::Clone for devstat_support_flags { } } -#[cfg_attr(feature = "extra_traits", derive(Debug, Hash, PartialEq, Eq))] #[repr(u32)] pub enum devstat_trans_flags { DEVSTAT_NO_DATA = 0x00, @@ -81,7 +79,6 @@ impl ::Clone for devstat_trans_flags { } } -#[cfg_attr(feature = "extra_traits", derive(Debug, Hash, PartialEq, Eq))] #[repr(u32)] pub enum devstat_tag_type { DEVSTAT_TAG_SIMPLE = 0x00, @@ -96,7 +93,6 @@ impl ::Clone for devstat_tag_type { } } -#[cfg_attr(feature = "extra_traits", derive(Debug, Hash, PartialEq, Eq))] #[repr(u32)] pub enum devstat_match_flags { DEVSTAT_MATCH_NONE = 0x00, @@ -111,7 +107,6 @@ impl ::Clone for devstat_match_flags { } } -#[cfg_attr(feature = "extra_traits", derive(Debug, Hash, PartialEq, Eq))] #[repr(u32)] pub enum devstat_priority { DEVSTAT_PRIORITY_MIN = 0x000, @@ -132,7 +127,6 @@ impl ::Clone for devstat_priority { } } -#[cfg_attr(feature = "extra_traits", derive(Debug, Hash, PartialEq, Eq))] #[repr(u32)] pub enum devstat_type_flags { DEVSTAT_TYPE_DIRECT = 0x000, @@ -164,7 +158,6 @@ impl ::Clone for devstat_type_flags { } } -#[cfg_attr(feature = "extra_traits", derive(Debug, Hash, PartialEq, Eq))] #[repr(u32)] pub enum devstat_metric { DSM_NONE, @@ -221,7 +214,6 @@ impl ::Clone for devstat_metric { } } -#[cfg_attr(feature = "extra_traits", derive(Debug, Hash, PartialEq, Eq))] #[repr(u32)] pub enum devstat_select_mode { DS_SELECT_ADD, @@ -1350,9 +1342,7 @@ s! { pub strchange_instrms: u16, pub strchange_outstrms: u16, } -} -s_no_extra_traits! { pub struct utmpx { pub ut_type: ::c_short, pub ut_tv: ::timeval, @@ -1623,916 +1613,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for utmpx { - fn eq(&self, other: &utmpx) -> bool { - self.ut_type == other.ut_type - && self.ut_tv == other.ut_tv - && self.ut_id == other.ut_id - && self.ut_pid == other.ut_pid - && self.ut_user == other.ut_user - && self.ut_line == other.ut_line - && self - .ut_host - .iter() - .zip(other.ut_host.iter()) - .all(|(a,b)| a == b) - && self - .__ut_spare - .iter() - .zip(other.__ut_spare.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for utmpx {} - impl ::fmt::Debug for utmpx { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("utmpx") - .field("ut_type", &self.ut_type) - .field("ut_tv", &self.ut_tv) - .field("ut_id", &self.ut_id) - .field("ut_pid", &self.ut_pid) - .field("ut_user", &self.ut_user) - .field("ut_line", &self.ut_line) - // FIXME: .field("ut_host", &self.ut_host) - // FIXME: .field("__ut_spare", &self.__ut_spare) - .finish() - } - } - impl ::hash::Hash for utmpx { - fn hash(&self, state: &mut H) { - self.ut_type.hash(state); - self.ut_tv.hash(state); - self.ut_id.hash(state); - self.ut_pid.hash(state); - self.ut_user.hash(state); - self.ut_line.hash(state); - self.ut_host.hash(state); - self.__ut_spare.hash(state); - } - } - - impl PartialEq for __c_anonymous_cr_pid { - fn eq(&self, other: &__c_anonymous_cr_pid) -> bool { - unsafe { self.cr_pid == other.cr_pid} - } - } - impl Eq for __c_anonymous_cr_pid {} - impl ::fmt::Debug for __c_anonymous_cr_pid { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("cr_pid") - .field("cr_pid", unsafe { &self.cr_pid }) - .finish() - } - } - impl ::hash::Hash for __c_anonymous_cr_pid { - fn hash(&self, state: &mut H) { - unsafe { self.cr_pid.hash(state) }; - } - } - - impl PartialEq for xucred { - fn eq(&self, other: &xucred) -> bool { - self.cr_version == other.cr_version - && self.cr_uid == other.cr_uid - && self.cr_ngroups == other.cr_ngroups - && self.cr_groups == other.cr_groups - && self.cr_pid__c_anonymous_union - == other.cr_pid__c_anonymous_union - } - } - impl Eq for xucred {} - impl ::fmt::Debug for xucred { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let mut struct_formatter = f.debug_struct("xucred"); - struct_formatter.field("cr_version", &self.cr_version); - struct_formatter.field("cr_uid", &self.cr_uid); - struct_formatter.field("cr_ngroups", &self.cr_ngroups); - struct_formatter.field("cr_groups", &self.cr_groups); - struct_formatter.field( - "cr_pid__c_anonymous_union", - &self.cr_pid__c_anonymous_union - ); - struct_formatter.finish() - } - } - impl ::hash::Hash for xucred { - fn hash(&self, state: &mut H) { - self.cr_version.hash(state); - self.cr_uid.hash(state); - self.cr_ngroups.hash(state); - self.cr_groups.hash(state); - self.cr_pid__c_anonymous_union.hash(state); - } - } - - impl PartialEq for sockaddr_dl { - fn eq(&self, other: &sockaddr_dl) -> bool { - self.sdl_len == other.sdl_len - && self.sdl_family == other.sdl_family - && self.sdl_index == other.sdl_index - && self.sdl_type == other.sdl_type - && self.sdl_nlen == other.sdl_nlen - && self.sdl_alen == other.sdl_alen - && self.sdl_slen == other.sdl_slen - && self - .sdl_data - .iter() - .zip(other.sdl_data.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for sockaddr_dl {} - impl ::fmt::Debug for sockaddr_dl { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_dl") - .field("sdl_len", &self.sdl_len) - .field("sdl_family", &self.sdl_family) - .field("sdl_index", &self.sdl_index) - .field("sdl_type", &self.sdl_type) - .field("sdl_nlen", &self.sdl_nlen) - .field("sdl_alen", &self.sdl_alen) - .field("sdl_slen", &self.sdl_slen) - // FIXME: .field("sdl_data", &self.sdl_data) - .finish() - } - } - impl ::hash::Hash for sockaddr_dl { - fn hash(&self, state: &mut H) { - self.sdl_len.hash(state); - self.sdl_family.hash(state); - self.sdl_index.hash(state); - self.sdl_type.hash(state); - self.sdl_nlen.hash(state); - self.sdl_alen.hash(state); - self.sdl_slen.hash(state); - self.sdl_data.hash(state); - } - } - - impl PartialEq for mq_attr { - fn eq(&self, other: &mq_attr) -> bool { - self.mq_flags == other.mq_flags && - self.mq_maxmsg == other.mq_maxmsg && - self.mq_msgsize == other.mq_msgsize && - self.mq_curmsgs == other.mq_curmsgs - } - } - impl Eq for mq_attr {} - impl ::fmt::Debug for mq_attr { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("mq_attr") - .field("mq_flags", &self.mq_flags) - .field("mq_maxmsg", &self.mq_maxmsg) - .field("mq_msgsize", &self.mq_msgsize) - .field("mq_curmsgs", &self.mq_curmsgs) - .finish() - } - } - impl ::hash::Hash for mq_attr { - fn hash(&self, state: &mut H) { - self.mq_flags.hash(state); - self.mq_maxmsg.hash(state); - self.mq_msgsize.hash(state); - self.mq_curmsgs.hash(state); - } - } - - impl PartialEq for sigevent { - fn eq(&self, other: &sigevent) -> bool { - self.sigev_notify == other.sigev_notify - && self.sigev_signo == other.sigev_signo - && self.sigev_value == other.sigev_value - && self.sigev_notify_thread_id - == other.sigev_notify_thread_id - } - } - impl Eq for sigevent {} - impl ::fmt::Debug for sigevent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sigevent") - .field("sigev_notify", &self.sigev_notify) - .field("sigev_signo", &self.sigev_signo) - .field("sigev_value", &self.sigev_value) - .field("sigev_notify_thread_id", - &self.sigev_notify_thread_id) - .finish() - } - } - impl ::hash::Hash for sigevent { - fn hash(&self, state: &mut H) { - self.sigev_notify.hash(state); - self.sigev_signo.hash(state); - self.sigev_value.hash(state); - self.sigev_notify_thread_id.hash(state); - } - } - - impl PartialEq for ptsstat { - fn eq(&self, other: &ptsstat) -> bool { - let self_devname: &[::c_char] = &self.devname; - let other_devname: &[::c_char] = &other.devname; - - self.dev == other.dev && self_devname == other_devname - } - } - impl Eq for ptsstat {} - impl ::fmt::Debug for ptsstat { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let self_devname: &[::c_char] = &self.devname; - - f.debug_struct("ptsstat") - .field("dev", &self.dev) - .field("devname", &self_devname) - .finish() - } - } - impl ::hash::Hash for ptsstat { - fn hash(&self, state: &mut H) { - let self_devname: &[::c_char] = &self.devname; - - self.dev.hash(state); - self_devname.hash(state); - } - } - - impl PartialEq for __c_anonymous_elf32_auxv_union { - fn eq(&self, other: &__c_anonymous_elf32_auxv_union) -> bool { - unsafe { self.a_val == other.a_val} - } - } - impl Eq for __c_anonymous_elf32_auxv_union {} - impl ::fmt::Debug for __c_anonymous_elf32_auxv_union { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("a_val") - .field("a_val", unsafe { &self.a_val }) - .finish() - } - } - impl PartialEq for Elf32_Auxinfo { - fn eq(&self, other: &Elf32_Auxinfo) -> bool { - self.a_type == other.a_type - && self.a_un == other.a_un - } - } - impl Eq for Elf32_Auxinfo {} - impl ::fmt::Debug for Elf32_Auxinfo { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("Elf32_Auxinfo") - .field("a_type", &self.a_type) - .field("a_un", &self.a_un) - .finish() - } - } - - impl PartialEq for __c_anonymous_ifr_ifru { - fn eq(&self, other: &__c_anonymous_ifr_ifru) -> bool { - unsafe { - self.ifru_addr == other.ifru_addr && - self.ifru_dstaddr == other.ifru_dstaddr && - self.ifru_broadaddr == other.ifru_broadaddr && - self.ifru_buffer == other.ifru_buffer && - self.ifru_flags == other.ifru_flags && - self.ifru_index == other.ifru_index && - self.ifru_jid == other.ifru_jid && - self.ifru_metric == other.ifru_metric && - self.ifru_mtu == other.ifru_mtu && - self.ifru_phys == other.ifru_phys && - self.ifru_media == other.ifru_media && - self.ifru_data == other.ifru_data && - self.ifru_cap == other.ifru_cap && - self.ifru_fib == other.ifru_fib && - self.ifru_vlan_pcp == other.ifru_vlan_pcp - } - } - } - impl Eq for __c_anonymous_ifr_ifru {} - impl ::fmt::Debug for __c_anonymous_ifr_ifru { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ifr_ifru") - .field("ifru_addr", unsafe { &self.ifru_addr }) - .field("ifru_dstaddr", unsafe { &self.ifru_dstaddr }) - .field("ifru_broadaddr", unsafe { &self.ifru_broadaddr }) - .field("ifru_buffer", unsafe { &self.ifru_buffer }) - .field("ifru_flags", unsafe { &self.ifru_flags }) - .field("ifru_index", unsafe { &self.ifru_index }) - .field("ifru_jid", unsafe { &self.ifru_jid }) - .field("ifru_metric", unsafe { &self.ifru_metric }) - .field("ifru_mtu", unsafe { &self.ifru_mtu }) - .field("ifru_phys", unsafe { &self.ifru_phys }) - .field("ifru_media", unsafe { &self.ifru_media }) - .field("ifru_data", unsafe { &self.ifru_data }) - .field("ifru_cap", unsafe { &self.ifru_cap }) - .field("ifru_fib", unsafe { &self.ifru_fib }) - .field("ifru_vlan_pcp", unsafe { &self.ifru_vlan_pcp }) - .finish() - } - } - impl ::hash::Hash for __c_anonymous_ifr_ifru { - fn hash(&self, state: &mut H) { - unsafe { self.ifru_addr.hash(state) }; - unsafe { self.ifru_dstaddr.hash(state) }; - unsafe { self.ifru_broadaddr.hash(state) }; - unsafe { self.ifru_buffer.hash(state) }; - unsafe { self.ifru_flags.hash(state) }; - unsafe { self.ifru_index.hash(state) }; - unsafe { self.ifru_jid.hash(state) }; - unsafe { self.ifru_metric.hash(state) }; - unsafe { self.ifru_mtu.hash(state) }; - unsafe { self.ifru_phys.hash(state) }; - unsafe { self.ifru_media.hash(state) }; - unsafe { self.ifru_data.hash(state) }; - unsafe { self.ifru_cap.hash(state) }; - unsafe { self.ifru_fib.hash(state) }; - unsafe { self.ifru_vlan_pcp.hash(state) }; - } - } - - impl PartialEq for ifreq { - fn eq(&self, other: &ifreq) -> bool { - self.ifr_name == other.ifr_name && self.ifr_ifru == other.ifr_ifru - } - } - impl Eq for ifreq {} - impl ::fmt::Debug for ifreq { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ifreq") - .field("ifr_name", &self.ifr_name) - .field("ifr_ifru", &self.ifr_ifru) - .finish() - } - } - impl ::hash::Hash for ifreq { - fn hash(&self, state: &mut H) { - self.ifr_name.hash(state); - self.ifr_ifru.hash(state); - } - } - - impl Eq for __c_anonymous_ifc_ifcu {} - - impl PartialEq for __c_anonymous_ifc_ifcu { - fn eq(&self, other: &__c_anonymous_ifc_ifcu) -> bool { - unsafe { - self.ifcu_buf == other.ifcu_buf && - self.ifcu_req == other.ifcu_req - } - } - } - - impl ::fmt::Debug for __c_anonymous_ifc_ifcu { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ifc_ifcu") - .field("ifcu_buf", unsafe { &self.ifcu_buf }) - .field("ifcu_req", unsafe { &self.ifcu_req }) - .finish() - } - } - - impl ::hash::Hash for __c_anonymous_ifc_ifcu { - fn hash(&self, state: &mut H) { - unsafe { self.ifcu_buf.hash(state) }; - unsafe { self.ifcu_req.hash(state) }; - } - } - - impl PartialEq for ifstat { - fn eq(&self, other: &ifstat) -> bool { - let self_ascii: &[::c_char] = &self.ascii; - let other_ascii: &[::c_char] = &other.ascii; - - self.ifs_name == other.ifs_name && self_ascii == other_ascii - } - } - impl Eq for ifstat {} - impl ::fmt::Debug for ifstat { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let ascii: &[::c_char] = &self.ascii; - - f.debug_struct("ifstat") - .field("ifs_name", &self.ifs_name) - .field("ascii", &ascii) - .finish() - } - } - impl ::hash::Hash for ifstat { - fn hash(&self, state: &mut H) { - self.ifs_name.hash(state); - self.ascii.hash(state); - } - } - - impl PartialEq for ifrsskey { - fn eq(&self, other: &ifrsskey) -> bool { - let self_ifrk_key: &[u8] = &self.ifrk_key; - let other_ifrk_key: &[u8] = &other.ifrk_key; - - self.ifrk_name == other.ifrk_name && - self.ifrk_func == other.ifrk_func && - self.ifrk_spare0 == other.ifrk_spare0 && - self.ifrk_keylen == other.ifrk_keylen && - self_ifrk_key == other_ifrk_key - } - } - impl Eq for ifrsskey {} - impl ::fmt::Debug for ifrsskey { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let ifrk_key: &[u8] = &self.ifrk_key; - - f.debug_struct("ifrsskey") - .field("ifrk_name", &self.ifrk_name) - .field("ifrk_func", &self.ifrk_func) - .field("ifrk_spare0", &self.ifrk_spare0) - .field("ifrk_keylen", &self.ifrk_keylen) - .field("ifrk_key", &ifrk_key) - .finish() - } - } - impl ::hash::Hash for ifrsskey { - fn hash(&self, state: &mut H) { - self.ifrk_name.hash(state); - self.ifrk_func.hash(state); - self.ifrk_spare0.hash(state); - self.ifrk_keylen.hash(state); - self.ifrk_key.hash(state); - } - } - - impl PartialEq for ifdownreason { - fn eq(&self, other: &ifdownreason) -> bool { - let self_ifdr_msg: &[::c_char] = &self.ifdr_msg; - let other_ifdr_msg: &[::c_char] = &other.ifdr_msg; - - self.ifdr_name == other.ifdr_name && - self.ifdr_reason == other.ifdr_reason && - self.ifdr_vendor == other.ifdr_vendor && - self_ifdr_msg == other_ifdr_msg - } - } - impl Eq for ifdownreason {} - impl ::fmt::Debug for ifdownreason { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let ifdr_msg: &[::c_char] = &self.ifdr_msg; - - f.debug_struct("ifdownreason") - .field("ifdr_name", &self.ifdr_name) - .field("ifdr_reason", &self.ifdr_reason) - .field("ifdr_vendor", &self.ifdr_vendor) - .field("ifdr_msg", &ifdr_msg) - .finish() - } - } - impl ::hash::Hash for ifdownreason { - fn hash(&self, state: &mut H) { - self.ifdr_name.hash(state); - self.ifdr_reason.hash(state); - self.ifdr_vendor.hash(state); - self.ifdr_msg.hash(state); - } - } - - impl PartialEq for __c_anonymous_ifi_epoch { - fn eq(&self, other: &__c_anonymous_ifi_epoch) -> bool { - unsafe { - self.tt == other.tt && - self.ph == other.ph - } - } - } - impl Eq for __c_anonymous_ifi_epoch {} - impl ::fmt::Debug for __c_anonymous_ifi_epoch { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("__c_anonymous_ifi_epoch") - .field("tt", unsafe { &self.tt }) - .field("ph", unsafe { &self.ph }) - .finish() - } - } - impl ::hash::Hash for __c_anonymous_ifi_epoch { - fn hash(&self, state: &mut H) { - unsafe { - self.tt.hash(state); - self.ph.hash(state); - } - } - } - - impl PartialEq for __c_anonymous_ifi_lastchange { - fn eq(&self, other: &__c_anonymous_ifi_lastchange) -> bool { - unsafe { - self.tv == other.tv && - self.ph == other.ph - } - } - } - impl Eq for __c_anonymous_ifi_lastchange {} - impl ::fmt::Debug for __c_anonymous_ifi_lastchange { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("__c_anonymous_ifi_lastchange") - .field("tv", unsafe { &self.tv }) - .field("ph", unsafe { &self.ph }) - .finish() - } - } - impl ::hash::Hash for __c_anonymous_ifi_lastchange { - fn hash(&self, state: &mut H) { - unsafe { - self.tv.hash(state); - self.ph.hash(state); - } - } - } - - impl PartialEq for if_data { - fn eq(&self, other: &if_data) -> bool { - self.ifi_type == other.ifi_type && - self.ifi_physical == other.ifi_physical && - self.ifi_addrlen == other.ifi_addrlen && - self.ifi_hdrlen == other.ifi_hdrlen && - self.ifi_link_state == other.ifi_link_state && - self.ifi_vhid == other.ifi_vhid && - self.ifi_datalen == other.ifi_datalen && - self.ifi_mtu == other.ifi_mtu && - self.ifi_metric == other.ifi_metric && - self.ifi_baudrate == other.ifi_baudrate && - self.ifi_ipackets == other.ifi_ipackets && - self.ifi_ierrors == other.ifi_ierrors && - self.ifi_opackets == other.ifi_opackets && - self.ifi_oerrors == other.ifi_oerrors && - self.ifi_collisions == other.ifi_collisions && - self.ifi_ibytes == other.ifi_ibytes && - self.ifi_obytes == other.ifi_obytes && - self.ifi_imcasts == other.ifi_imcasts && - self.ifi_omcasts == other.ifi_omcasts && - self.ifi_iqdrops == other.ifi_iqdrops && - self.ifi_oqdrops == other.ifi_oqdrops && - self.ifi_noproto == other.ifi_noproto && - self.ifi_hwassist == other.ifi_hwassist && - self.__ifi_epoch == other.__ifi_epoch && - self.__ifi_lastchange == other.__ifi_lastchange - } - } - impl Eq for if_data {} - impl ::fmt::Debug for if_data { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("if_data") - .field("ifi_type", &self.ifi_type) - .field("ifi_physical", &self.ifi_physical) - .field("ifi_addrlen", &self.ifi_addrlen) - .field("ifi_hdrlen", &self.ifi_hdrlen) - .field("ifi_link_state", &self.ifi_link_state) - .field("ifi_vhid", &self.ifi_vhid) - .field("ifi_datalen", &self.ifi_datalen) - .field("ifi_mtu", &self.ifi_mtu) - .field("ifi_metric", &self.ifi_metric) - .field("ifi_baudrate", &self.ifi_baudrate) - .field("ifi_ipackets", &self.ifi_ipackets) - .field("ifi_ierrors", &self.ifi_ierrors) - .field("ifi_opackets", &self.ifi_opackets) - .field("ifi_oerrors", &self.ifi_oerrors) - .field("ifi_collisions", &self.ifi_collisions) - .field("ifi_ibytes", &self.ifi_ibytes) - .field("ifi_obytes", &self.ifi_obytes) - .field("ifi_imcasts", &self.ifi_imcasts) - .field("ifi_omcasts", &self.ifi_omcasts) - .field("ifi_iqdrops", &self.ifi_iqdrops) - .field("ifi_oqdrops", &self.ifi_oqdrops) - .field("ifi_noproto", &self.ifi_noproto) - .field("ifi_hwassist", &self.ifi_hwassist) - .field("__ifi_epoch", &self.__ifi_epoch) - .field("__ifi_lastchange", &self.__ifi_lastchange) - .finish() - } - } - impl ::hash::Hash for if_data { - fn hash(&self, state: &mut H) { - self.ifi_type.hash(state); - self.ifi_physical.hash(state); - self.ifi_addrlen.hash(state); - self.ifi_hdrlen.hash(state); - self.ifi_link_state.hash(state); - self.ifi_vhid.hash(state); - self.ifi_datalen.hash(state); - self.ifi_mtu.hash(state); - self.ifi_metric.hash(state); - self.ifi_baudrate.hash(state); - self.ifi_ipackets.hash(state); - self.ifi_ierrors.hash(state); - self.ifi_opackets.hash(state); - self.ifi_oerrors.hash(state); - self.ifi_collisions.hash(state); - self.ifi_ibytes.hash(state); - self.ifi_obytes.hash(state); - self.ifi_imcasts.hash(state); - self.ifi_omcasts.hash(state); - self.ifi_iqdrops.hash(state); - self.ifi_oqdrops.hash(state); - self.ifi_noproto.hash(state); - self.ifi_hwassist.hash(state); - self.__ifi_epoch.hash(state); - self.__ifi_lastchange.hash(state); - } - } - - impl PartialEq for sctphdr { - fn eq(&self, other: &sctphdr) -> bool { - return {self.src_port} == {other.src_port} && - {self.dest_port} == {other.dest_port} && - {self.v_tag} == {other.v_tag} && - {self.checksum} == {other.checksum} - } - } - impl Eq for sctphdr {} - impl ::fmt::Debug for sctphdr { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sctphdr") - .field("src_port", &{self.src_port}) - .field("dest_port", &{self.dest_port}) - .field("v_tag", &{self.v_tag}) - .field("checksum", &{self.checksum}) - .finish() - } - } - impl ::hash::Hash for sctphdr { - fn hash(&self, state: &mut H) { - {self.src_port}.hash(state); - {self.dest_port}.hash(state); - {self.v_tag}.hash(state); - {self.checksum}.hash(state); - } - } - - impl PartialEq for sctp_chunkhdr { - fn eq(&self, other: &sctp_chunkhdr) -> bool { - return {self.chunk_type} == {other.chunk_type} && - {self.chunk_flags} == {other.chunk_flags} && - {self.chunk_length} == {other.chunk_length} - } - } - impl Eq for sctp_chunkhdr {} - impl ::fmt::Debug for sctp_chunkhdr { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sctp_chunkhdr") - .field("chunk_type", &{self.chunk_type}) - .field("chunk_flags", &{self.chunk_flags}) - .field("chunk_length", &{self.chunk_length}) - .finish() - } - } - impl ::hash::Hash for sctp_chunkhdr { - fn hash(&self, state: &mut H) { - {self.chunk_type}.hash(state); - {self.chunk_flags}.hash(state); - {self.chunk_length}.hash(state); - } - } - - impl PartialEq for sctp_paramhdr { - fn eq(&self, other: &sctp_paramhdr) -> bool { - return {self.param_type} == {other.param_type} && - {self.param_length} == {other.param_length} - } - } - impl Eq for sctp_paramhdr {} - impl ::fmt::Debug for sctp_paramhdr { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sctp_paramhdr") - .field("param_type", &{self.param_type}) - .field("param_length", &{self.param_length}) - .finish() - } - } - impl ::hash::Hash for sctp_paramhdr { - fn hash(&self, state: &mut H) { - {self.param_type}.hash(state); - {self.param_length}.hash(state); - } - } - - impl PartialEq for sctp_gen_error_cause { - fn eq(&self, other: &sctp_gen_error_cause) -> bool { - return {self.code} == {other.code} && - {self.length} == {other.length} && - {self.info}.iter().zip({other.info}.iter()).all(|(a,b)| a == b) - } - } - impl Eq for sctp_gen_error_cause {} - impl ::fmt::Debug for sctp_gen_error_cause { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sctp_gen_error_cause") - .field("code", &{self.code}) - .field("length", &{self.length}) - // FIXME: .field("info", &{self.info}) - .finish() - } - } - impl ::hash::Hash for sctp_gen_error_cause { - fn hash(&self, state: &mut H) { - {self.code}.hash(state); - {self.length}.hash(state); - {self.info}.hash(state); - } - } - - impl PartialEq for sctp_error_cause { - fn eq(&self, other: &sctp_error_cause) -> bool { - return {self.code} == {other.code} && - {self.length} == {other.length} - } - } - impl Eq for sctp_error_cause {} - impl ::fmt::Debug for sctp_error_cause { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sctp_error_cause") - .field("code", &{self.code}) - .field("length", &{self.length}) - .finish() - } - } - impl ::hash::Hash for sctp_error_cause { - fn hash(&self, state: &mut H) { - {self.code}.hash(state); - {self.length}.hash(state); - } - } - - impl PartialEq for sctp_error_invalid_stream { - fn eq(&self, other: &sctp_error_invalid_stream) -> bool { - return {self.cause} == {other.cause} && - {self.stream_id} == {other.stream_id} - } - } - impl Eq for sctp_error_invalid_stream {} - impl ::fmt::Debug for sctp_error_invalid_stream { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sctp_error_invalid_stream") - .field("cause", &{self.cause}) - .field("stream_id", &{self.stream_id}) - .finish() - } - } - impl ::hash::Hash for sctp_error_invalid_stream { - fn hash(&self, state: &mut H) { - {self.cause}.hash(state); - {self.stream_id}.hash(state); - } - } - - impl PartialEq for sctp_error_missing_param { - fn eq(&self, other: &sctp_error_missing_param) -> bool { - return {self.cause} == {other.cause} && - {self.num_missing_params} == {other.num_missing_params} && - {self.tpe}.iter().zip({other.tpe}.iter()).all(|(a,b)| a == b) - } - } - impl Eq for sctp_error_missing_param {} - impl ::fmt::Debug for sctp_error_missing_param { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sctp_error_missing_param") - .field("cause", &{self.cause}) - .field("num_missing_params", &{self.num_missing_params}) - // FIXME: .field("tpe", &{self.tpe}) - .finish() - } - } - impl ::hash::Hash for sctp_error_missing_param { - fn hash(&self, state: &mut H) { - {self.cause}.hash(state); - {self.num_missing_params}.hash(state); - {self.tpe}.hash(state); - } - } - - impl PartialEq for sctp_error_stale_cookie { - fn eq(&self, other: &sctp_error_stale_cookie) -> bool { - return {self.cause} == {other.cause} && - {self.stale_time} == {other.stale_time} - } - } - impl Eq for sctp_error_stale_cookie {} - impl ::fmt::Debug for sctp_error_stale_cookie { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sctp_error_stale_cookie") - .field("cause", &{self.cause}) - .field("stale_time", &{self.stale_time}) - .finish() - } - } - impl ::hash::Hash for sctp_error_stale_cookie { - fn hash(&self, state: &mut H) { - {self.cause}.hash(state); - {self.stale_time}.hash(state); - } - } - - impl PartialEq for sctp_error_out_of_resource { - fn eq(&self, other: &sctp_error_out_of_resource) -> bool { - return {self.cause} == {other.cause} - } - } - impl Eq for sctp_error_out_of_resource {} - impl ::fmt::Debug for sctp_error_out_of_resource { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sctp_error_out_of_resource") - .field("cause", &{self.cause}) - .finish() - } - } - impl ::hash::Hash for sctp_error_out_of_resource { - fn hash(&self, state: &mut H) { - {self.cause}.hash(state); - } - } - - impl PartialEq for sctp_error_unresolv_addr { - fn eq(&self, other: &sctp_error_unresolv_addr) -> bool { - return {self.cause} == {other.cause} - } - } - impl Eq for sctp_error_unresolv_addr {} - impl ::fmt::Debug for sctp_error_unresolv_addr { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sctp_error_unresolv_addr") - .field("cause", &{self.cause}) - .finish() - } - } - impl ::hash::Hash for sctp_error_unresolv_addr { - fn hash(&self, state: &mut H) { - {self.cause}.hash(state); - } - } - - impl PartialEq for sctp_error_unrecognized_chunk { - fn eq(&self, other: &sctp_error_unrecognized_chunk) -> bool { - return {self.cause} == {other.cause} && - {self.ch} == {other.ch} - } - } - impl Eq for sctp_error_unrecognized_chunk {} - impl ::fmt::Debug for sctp_error_unrecognized_chunk { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sctp_error_unrecognized_chunk") - .field("cause", &{self.cause}) - .field("ch", &{self.ch}) - .finish() - } - } - impl ::hash::Hash for sctp_error_unrecognized_chunk { - fn hash(&self, state: &mut H) { - {self.cause}.hash(state); - {self.ch}.hash(state); - } - } - - impl PartialEq for sctp_error_no_user_data { - fn eq(&self, other: &sctp_error_no_user_data) -> bool { - return {self.cause} == {other.cause} && - {self.tsn} == {other.tsn} - } - } - impl Eq for sctp_error_no_user_data {} - impl ::fmt::Debug for sctp_error_no_user_data { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sctp_error_no_user_data") - .field("cause", &{self.cause}) - .field("tsn", &{self.tsn}) - .finish() - } - } - impl ::hash::Hash for sctp_error_no_user_data { - fn hash(&self, state: &mut H) { - {self.cause}.hash(state); - {self.tsn}.hash(state); - } - } - - impl PartialEq for sctp_error_auth_invalid_hmac { - fn eq(&self, other: &sctp_error_auth_invalid_hmac) -> bool { - return {self.cause} == {other.cause} && - {self.hmac_id} == {other.hmac_id} - } - } - impl Eq for sctp_error_auth_invalid_hmac {} - impl ::fmt::Debug for sctp_error_auth_invalid_hmac { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sctp_error_invalid_hmac") - .field("cause", &{self.cause}) - .field("hmac_id", &{self.hmac_id}) - .finish() - } - } - impl ::hash::Hash for sctp_error_auth_invalid_hmac { - fn hash(&self, state: &mut H) { - {self.cause}.hash(state); - {self.hmac_id}.hash(state); - } - } - } -} - -#[cfg_attr(feature = "extra_traits", derive(Debug))] #[repr(u32)] pub enum dot3Vendors { dot3VendorAMD = 1, diff --git a/src/unix/bsd/freebsdlike/freebsd/riscv64.rs b/src/unix/bsd/freebsdlike/freebsd/riscv64.rs index c5ea8ee203a72..2676dd3e2dc0c 100644 --- a/src/unix/bsd/freebsdlike/freebsd/riscv64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/riscv64.rs @@ -6,7 +6,7 @@ pub type time_t = i64; pub type suseconds_t = ::c_long; pub type register_t = i64; -s_no_extra_traits! { +s! { pub struct gpregs { pub gp_ra: ::register_t, pub gp_sp: ::register_t, @@ -37,109 +37,5 @@ s_no_extra_traits! { pub(crate) const _ALIGNBYTES: usize = ::mem::size_of::<::c_longlong>() - 1; -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for gpregs { - fn eq(&self, other: &gpregs) -> bool { - self.gp_ra == other.gp_ra && - self.gp_sp == other.gp_sp && - self.gp_gp == other.gp_gp && - self.gp_tp == other.gp_tp && - self.gp_t.iter().zip(other.gp_t.iter()).all(|(a, b)| a == b) && - self.gp_s.iter().zip(other.gp_s.iter()).all(|(a, b)| a == b) && - self.gp_a.iter().zip(other.gp_a.iter()).all(|(a, b)| a == b) && - self.gp_sepc == other.gp_sepc && - self.gp_sstatus == other.gp_sstatus - } - } - impl Eq for gpregs {} - impl ::fmt::Debug for gpregs { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("gpregs") - .field("gp_ra", &self.gp_ra) - .field("gp_sp", &self.gp_sp) - .field("gp_gp", &self.gp_gp) - .field("gp_tp", &self.gp_tp) - .field("gp_t", &self.gp_t) - .field("gp_s", &self.gp_s) - .field("gp_a", &self.gp_a) - .field("gp_sepc", &self.gp_sepc) - .field("gp_sstatus", &self.gp_sstatus) - .finish() - } - } - impl ::hash::Hash for gpregs { - fn hash(&self, state: &mut H) { - self.gp_ra.hash(state); - self.gp_sp.hash(state); - self.gp_gp.hash(state); - self.gp_tp.hash(state); - self.gp_t.hash(state); - self.gp_s.hash(state); - self.gp_a.hash(state); - self.gp_sepc.hash(state); - self.gp_sstatus.hash(state); - } - } - impl PartialEq for fpregs { - fn eq(&self, other: &fpregs) -> bool { - self.fp_x == other.fp_x && - self.fp_fcsr == other.fp_fcsr && - self.fp_flags == other.fp_flags && - self.fp_pad == other.fp_pad - } - } - impl Eq for fpregs {} - impl ::fmt::Debug for fpregs { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("fpregs") - .field("fp_x", &self.fp_x) - .field("fp_fcsr", &self.fp_fcsr) - .field("fp_flags", &self.fp_flags) - .field("fp_pad", &self.fp_pad) - .finish() - } - } - impl ::hash::Hash for fpregs { - fn hash(&self, state: &mut H) { - self.fp_x.hash(state); - self.fp_fcsr.hash(state); - self.fp_flags.hash(state); - self.fp_pad.hash(state); - } - } - impl PartialEq for mcontext_t { - fn eq(&self, other: &mcontext_t) -> bool { - self.mc_gpregs == other.mc_gpregs && - self.mc_fpregs == other.mc_fpregs && - self.mc_flags == other.mc_flags && - self.mc_pad == other.mc_pad && - self.mc_spare.iter().zip(other.mc_spare.iter()).all(|(a, b)| a == b) - } - } - impl Eq for mcontext_t {} - impl ::fmt::Debug for mcontext_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("mcontext_t") - .field("mc_gpregs", &self.mc_gpregs) - .field("mc_fpregs", &self.mc_fpregs) - .field("mc_flags", &self.mc_flags) - .field("mc_pad", &self.mc_pad) - .field("mc_spare", &self.mc_spare) - .finish() - } - } - impl ::hash::Hash for mcontext_t { - fn hash(&self, state: &mut H) { - self.mc_gpregs.hash(state); - self.mc_fpregs.hash(state); - self.mc_flags.hash(state); - self.mc_pad.hash(state); - self.mc_spare.hash(state); - } - } - } -} - pub const MAP_32BIT: ::c_int = 0x00080000; pub const MINSIGSTKSZ: ::size_t = 4096; // 1024 * 4 diff --git a/src/unix/bsd/freebsdlike/freebsd/x86.rs b/src/unix/bsd/freebsdlike/freebsd/x86.rs index 29689c910689f..5e6b5248a3d20 100644 --- a/src/unix/bsd/freebsdlike/freebsd/x86.rs +++ b/src/unix/bsd/freebsdlike/freebsd/x86.rs @@ -6,7 +6,7 @@ pub type time_t = i32; pub type suseconds_t = i32; pub type register_t = i32; -s_no_extra_traits! { +s! { pub struct mcontext_t { pub mc_onstack: register_t, pub mc_gs: register_t, @@ -39,9 +39,7 @@ s_no_extra_traits! { pub mc_xfpustate_len: register_t, pub mc_spare2: [::c_int; 4], } -} -s! { pub struct stat { pub st_dev: ::dev_t, pub st_ino: ::ino_t, @@ -79,114 +77,4 @@ s! { pub(crate) const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1; -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for mcontext_t { - fn eq(&self, other: &mcontext_t) -> bool { - self.mc_onstack == other.mc_onstack && - self.mc_gs == other.mc_gs && - self.mc_fs == other.mc_fs && - self.mc_es == other.mc_es && - self.mc_ds == other.mc_ds && - self.mc_edi == other.mc_edi && - self.mc_esi == other.mc_esi && - self.mc_ebp == other.mc_ebp && - self.mc_isp == other.mc_isp && - self.mc_ebx == other.mc_ebx && - self.mc_edx == other.mc_edx && - self.mc_ecx == other.mc_ecx && - self.mc_eax == other.mc_eax && - self.mc_trapno == other.mc_trapno && - self.mc_err == other.mc_err && - self.mc_eip == other.mc_eip && - self.mc_cs == other.mc_cs && - self.mc_eflags == other.mc_eflags && - self.mc_esp == other.mc_esp && - self.mc_ss == other.mc_ss && - self.mc_len == other.mc_len && - self.mc_fpformat == other.mc_fpformat && - self.mc_ownedfp == other.mc_ownedfp && - self.mc_flags == other.mc_flags && - self.mc_fpstate.iter().zip(other.mc_fpstate.iter()).all(|(a, b)| a == b) && - self.mc_fsbase == other.mc_fsbase && - self.mc_gsbase == other.mc_gsbase && - self.mc_xfpustate == other.mc_xfpustate && - self.mc_xfpustate_len == other.mc_xfpustate_len && - self.mc_spare2.iter().zip(other.mc_spare2.iter()).all(|(a, b)| a == b) - } - } - impl Eq for mcontext_t {} - impl ::fmt::Debug for mcontext_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("mcontext_t") - .field("mc_onstack", &self.mc_onstack) - .field("mc_gs", &self.mc_gs) - .field("mc_fs", &self.mc_fs) - .field("mc_es", &self.mc_es) - .field("mc_ds", &self.mc_ds) - .field("mc_edi", &self.mc_edi) - .field("mc_esi", &self.mc_esi) - .field("mc_ebp", &self.mc_ebp) - .field("mc_isp", &self.mc_isp) - .field("mc_ebx", &self.mc_ebx) - .field("mc_edx", &self.mc_edx) - .field("mc_ecx", &self.mc_ecx) - .field("mc_eax", &self.mc_eax) - .field("mc_trapno", &self.mc_trapno) - .field("mc_err", &self.mc_err) - .field("mc_eip", &self.mc_eip) - .field("mc_cs", &self.mc_cs) - .field("mc_eflags", &self.mc_eflags) - .field("mc_esp", &self.mc_esp) - .field("mc_ss", &self.mc_ss) - .field("mc_len", &self.mc_len) - .field("mc_fpformat", &self.mc_fpformat) - .field("mc_ownedfp", &self.mc_ownedfp) - .field("mc_flags", &self.mc_flags) - .field("mc_fpstate", &self.mc_fpstate) - .field("mc_fsbase", &self.mc_fsbase) - .field("mc_gsbase", &self.mc_gsbase) - .field("mc_xfpustate", &self.mc_xfpustate) - .field("mc_xfpustate_len", &self.mc_xfpustate_len) - .field("mc_spare2", &self.mc_spare2) - .finish() - } - } - impl ::hash::Hash for mcontext_t { - fn hash(&self, state: &mut H) { - self.mc_onstack.hash(state); - self.mc_gs.hash(state); - self.mc_fs.hash(state); - self.mc_es.hash(state); - self.mc_ds.hash(state); - self.mc_edi.hash(state); - self.mc_esi.hash(state); - self.mc_ebp.hash(state); - self.mc_isp.hash(state); - self.mc_ebx.hash(state); - self.mc_edx.hash(state); - self.mc_ecx.hash(state); - self.mc_eax.hash(state); - self.mc_trapno.hash(state); - self.mc_err.hash(state); - self.mc_eip.hash(state); - self.mc_cs.hash(state); - self.mc_eflags.hash(state); - self.mc_esp.hash(state); - self.mc_ss.hash(state); - self.mc_len.hash(state); - self.mc_fpformat.hash(state); - self.mc_ownedfp.hash(state); - self.mc_flags.hash(state); - self.mc_fpstate.hash(state); - self.mc_fsbase.hash(state); - self.mc_gsbase.hash(state); - self.mc_xfpustate.hash(state); - self.mc_xfpustate_len.hash(state); - self.mc_spare2.hash(state); - } - } - } -} - pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4 diff --git a/src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs b/src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs index 3a016a0519852..0fe07e92429b2 100644 --- a/src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs +++ b/src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs @@ -1,7 +1,6 @@ use {c_long, register_t}; -s_no_extra_traits! { - #[allow(missing_debug_implementations)] +s! { #[repr(align(16))] pub struct max_align_t { priv_: [f64; 4] @@ -48,144 +47,7 @@ s_no_extra_traits! { pub mc_xfpustate_len: register_t, pub mc_spare: [c_long; 4], } -} - -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for mcontext_t { - fn eq(&self, other: &mcontext_t) -> bool { - self.mc_onstack == other.mc_onstack && - self.mc_rdi == other.mc_rdi && - self.mc_rsi == other.mc_rsi && - self.mc_rdx == other.mc_rdx && - self.mc_rcx == other.mc_rcx && - self.mc_r8 == other.mc_r8 && - self.mc_r9 == other.mc_r9 && - self.mc_rax == other.mc_rax && - self.mc_rbx == other.mc_rbx && - self.mc_rbp == other.mc_rbp && - self.mc_r10 == other.mc_r10 && - self.mc_r11 == other.mc_r11 && - self.mc_r12 == other.mc_r12 && - self.mc_r13 == other.mc_r13 && - self.mc_r14 == other.mc_r14 && - self.mc_r15 == other.mc_r15 && - self.mc_trapno == other.mc_trapno && - self.mc_fs == other.mc_fs && - self.mc_gs == other.mc_gs && - self.mc_addr == other.mc_addr && - self.mc_flags == other.mc_flags && - self.mc_es == other.mc_es && - self.mc_ds == other.mc_ds && - self.mc_err == other.mc_err && - self.mc_rip == other.mc_rip && - self.mc_cs == other.mc_cs && - self.mc_rflags == other.mc_rflags && - self.mc_rsp == other.mc_rsp && - self.mc_ss == other.mc_ss && - self.mc_len == other.mc_len && - self.mc_fpformat == other.mc_fpformat && - self.mc_ownedfp == other.mc_ownedfp && - self.mc_fpstate.iter().zip(other.mc_fpstate.iter()) - .all(|(a, b)| a == b) && - self.mc_fsbase == other.mc_fsbase && - self.mc_gsbase == other.mc_gsbase && - self.mc_xfpustate == other.mc_xfpustate && - self.mc_xfpustate_len == other.mc_xfpustate_len && - self.mc_spare == other.mc_spare - } - } - impl Eq for mcontext_t {} - impl ::fmt::Debug for mcontext_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("mcontext_t") - .field("mc_onstack", &self.mc_onstack) - .field("mc_rdi", &self.mc_rdi) - .field("mc_rsi", &self.mc_rsi) - .field("mc_rdx", &self.mc_rdx) - .field("mc_rcx", &self.mc_rcx) - .field("mc_r8", &self.mc_r8) - .field("mc_r9", &self.mc_r9) - .field("mc_rax", &self.mc_rax) - .field("mc_rbx", &self.mc_rbx) - .field("mc_rbp", &self.mc_rbp) - .field("mc_r10", &self.mc_r10) - .field("mc_r11", &self.mc_r11) - .field("mc_r12", &self.mc_r12) - .field("mc_r13", &self.mc_r13) - .field("mc_r14", &self.mc_r14) - .field("mc_r15", &self.mc_r15) - .field("mc_trapno", &self.mc_trapno) - .field("mc_fs", &self.mc_fs) - .field("mc_gs", &self.mc_gs) - .field("mc_addr", &self.mc_addr) - .field("mc_flags", &self.mc_flags) - .field("mc_es", &self.mc_es) - .field("mc_ds", &self.mc_ds) - .field("mc_err", &self.mc_err) - .field("mc_rip", &self.mc_rip) - .field("mc_cs", &self.mc_cs) - .field("mc_rflags", &self.mc_rflags) - .field("mc_rsp", &self.mc_rsp) - .field("mc_ss", &self.mc_ss) - .field("mc_len", &self.mc_len) - .field("mc_fpformat", &self.mc_fpformat) - .field("mc_ownedfp", &self.mc_ownedfp) - // FIXME: .field("mc_fpstate", &self.mc_fpstate) - .field("mc_fsbase", &self.mc_fsbase) - .field("mc_gsbase", &self.mc_gsbase) - .field("mc_xfpustate", &self.mc_xfpustate) - .field("mc_xfpustate_len", &self.mc_xfpustate_len) - .field("mc_spare", &self.mc_spare) - .finish() - } - } - impl ::hash::Hash for mcontext_t { - fn hash(&self, state: &mut H) { - self.mc_onstack.hash(state); - self.mc_rdi.hash(state); - self.mc_rsi.hash(state); - self.mc_rdx.hash(state); - self.mc_rcx.hash(state); - self.mc_r8.hash(state); - self.mc_r9.hash(state); - self.mc_rax.hash(state); - self.mc_rbx.hash(state); - self.mc_rbp.hash(state); - self.mc_r10.hash(state); - self.mc_r11.hash(state); - self.mc_r12.hash(state); - self.mc_r13.hash(state); - self.mc_r14.hash(state); - self.mc_r15.hash(state); - self.mc_trapno.hash(state); - self.mc_fs.hash(state); - self.mc_gs.hash(state); - self.mc_addr.hash(state); - self.mc_flags.hash(state); - self.mc_es.hash(state); - self.mc_ds.hash(state); - self.mc_err.hash(state); - self.mc_rip.hash(state); - self.mc_cs.hash(state); - self.mc_rflags.hash(state); - self.mc_rsp.hash(state); - self.mc_ss.hash(state); - self.mc_len.hash(state); - self.mc_fpformat.hash(state); - self.mc_ownedfp.hash(state); - self.mc_fpstate.hash(state); - self.mc_fsbase.hash(state); - self.mc_gsbase.hash(state); - self.mc_xfpustate.hash(state); - self.mc_xfpustate_len.hash(state); - self.mc_spare.hash(state); - } - } - } -} -s! { pub struct ucontext_t { pub uc_sigmask: ::sigset_t, pub uc_mcontext: ::mcontext_t, diff --git a/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs b/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs index c94695ed06cfb..66c8e1328dd6e 100644 --- a/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs @@ -57,9 +57,7 @@ s! { pub r_rsp: i64, pub r_ss: i64, } -} -s_no_extra_traits! { pub struct fpreg32 { pub fpr_env: [u32; 7], pub fpr_acc: [[u8; 10]; 8], @@ -110,177 +108,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for fpreg32 { - fn eq(&self, other: &fpreg32) -> bool { - self.fpr_env == other.fpr_env && - self.fpr_acc == other.fpr_acc && - self.fpr_ex_sw == other.fpr_ex_sw && - self.fpr_pad - .iter() - .zip(other.fpr_pad.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for fpreg32 {} - impl ::fmt::Debug for fpreg32 { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("fpreg32") - .field("fpr_env", &&self.fpr_env[..]) - .field("fpr_acc", &self.fpr_acc) - .field("fpr_ex_sw", &self.fpr_ex_sw) - .field("fpr_pad", &&self.fpr_pad[..]) - .finish() - } - } - impl ::hash::Hash for fpreg32 { - fn hash(&self, state: &mut H) { - self.fpr_env.hash(state); - self.fpr_acc.hash(state); - self.fpr_ex_sw.hash(state); - self.fpr_pad.hash(state); - } - } - - impl PartialEq for fpreg { - fn eq(&self, other: &fpreg) -> bool { - self.fpr_env == other.fpr_env && - self.fpr_acc == other.fpr_acc && - self.fpr_xacc == other.fpr_xacc && - self.fpr_spare == other.fpr_spare - } - } - impl Eq for fpreg {} - impl ::fmt::Debug for fpreg { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("fpreg") - .field("fpr_env", &self.fpr_env) - .field("fpr_acc", &self.fpr_acc) - .field("fpr_xacc", &self.fpr_xacc) - .field("fpr_spare", &self.fpr_spare) - .finish() - } - } - impl ::hash::Hash for fpreg { - fn hash(&self, state: &mut H) { - self.fpr_env.hash(state); - self.fpr_acc.hash(state); - self.fpr_xacc.hash(state); - self.fpr_spare.hash(state); - } - } - - impl PartialEq for xmmreg { - fn eq(&self, other: &xmmreg) -> bool { - self.xmm_env == other.xmm_env && - self.xmm_acc == other.xmm_acc && - self.xmm_reg == other.xmm_reg && - self.xmm_pad - .iter() - .zip(other.xmm_pad.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for xmmreg {} - impl ::fmt::Debug for xmmreg { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("xmmreg") - .field("xmm_env", &self.xmm_env) - .field("xmm_acc", &self.xmm_acc) - .field("xmm_reg", &self.xmm_reg) - .field("xmm_pad", &&self.xmm_pad[..]) - .finish() - } - } - impl ::hash::Hash for xmmreg { - fn hash(&self, state: &mut H) { - self.xmm_env.hash(state); - self.xmm_acc.hash(state); - self.xmm_reg.hash(state); - self.xmm_pad.hash(state); - } - } - - impl PartialEq for __c_anonymous_elf64_auxv_union { - fn eq(&self, other: &__c_anonymous_elf64_auxv_union) -> bool { - unsafe { self.a_val == other.a_val - || self.a_ptr == other.a_ptr - || self.a_fcn == other.a_fcn } - } - } - impl Eq for __c_anonymous_elf64_auxv_union {} - impl ::fmt::Debug for __c_anonymous_elf64_auxv_union { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("a_val") - .field("a_val", unsafe { &self.a_val }) - .finish() - } - } - impl PartialEq for Elf64_Auxinfo { - fn eq(&self, other: &Elf64_Auxinfo) -> bool { - self.a_type == other.a_type - && self.a_un == other.a_un - } - } - impl Eq for Elf64_Auxinfo {} - impl ::fmt::Debug for Elf64_Auxinfo { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("Elf64_Auxinfo") - .field("a_type", &self.a_type) - .field("a_un", &self.a_un) - .finish() - } - } - - impl PartialEq for kinfo_file { - fn eq(&self, other: &kinfo_file) -> bool { - self.kf_structsize == other.kf_structsize && - self.kf_type == other.kf_type && - self.kf_fd == other.kf_fd && - self.kf_ref_count == other.kf_ref_count && - self.kf_flags == other.kf_flags && - self.kf_offset == other.kf_offset && - self.kf_status == other.kf_status && - self.kf_cap_rights == other.kf_cap_rights && - self.kf_path - .iter() - .zip(other.kf_path.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for kinfo_file {} - impl ::fmt::Debug for kinfo_file { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("kinfo_file") - .field("kf_structsize", &self.kf_structsize) - .field("kf_type", &self.kf_type) - .field("kf_fd", &self.kf_fd) - .field("kf_ref_count", &self.kf_ref_count) - .field("kf_flags", &self.kf_flags) - .field("kf_offset", &self.kf_offset) - .field("kf_status", &self.kf_status) - .field("kf_cap_rights", &self.kf_cap_rights) - .field("kf_path", &&self.kf_path[..]) - .finish() - } - } - impl ::hash::Hash for kinfo_file { - fn hash(&self, state: &mut H) { - self.kf_structsize.hash(state); - self.kf_type.hash(state); - self.kf_fd.hash(state); - self.kf_ref_count.hash(state); - self.kf_flags.hash(state); - self.kf_offset.hash(state); - self.kf_status.hash(state); - self.kf_cap_rights.hash(state); - self.kf_path.hash(state); - } - } - } -} - pub(crate) const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1; pub const MAP_32BIT: ::c_int = 0x00080000; diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index 72ab61fae6cac..0835dd0b57b78 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -53,7 +53,6 @@ cfg_if! { // link.h -#[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum timezone {} impl ::Copy for timezone {} impl ::Clone for timezone { @@ -380,9 +379,7 @@ s! { pub struct eui64 { pub octet: [u8; EUI64_LEN], } -} -s_no_extra_traits! { pub struct sockaddr_storage { pub ss_len: u8, pub ss_family: ::sa_family_t, @@ -392,45 +389,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for sockaddr_storage { - fn eq(&self, other: &sockaddr_storage) -> bool { - self.ss_len == other.ss_len - && self.ss_family == other.ss_family - && self.__ss_pad1 == other.__ss_pad1 - && self.__ss_align == other.__ss_align - && self - .__ss_pad2 - .iter() - .zip(other.__ss_pad2.iter()) - .all(|(a, b)| a == b) - } - } - impl Eq for sockaddr_storage {} - impl ::fmt::Debug for sockaddr_storage { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_storage") - .field("ss_len", &self.ss_len) - .field("ss_family", &self.ss_family) - .field("__ss_pad1", &self.__ss_pad1) - .field("__ss_align", &self.__ss_align) - // FIXME: .field("__ss_pad2", &self.__ss_pad2) - .finish() - } - } - impl ::hash::Hash for sockaddr_storage { - fn hash(&self, state: &mut H) { - self.ss_len.hash(state); - self.ss_family.hash(state); - self.__ss_pad1.hash(state); - self.__ss_align.hash(state); - self.__ss_pad2.hash(state); - } - } - } -} - // Non-public helper constant const SIZEOF_LONG: usize = ::mem::size_of::<::c_long>(); diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index e2b5121b03911..375d279bd41b0 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -122,9 +122,7 @@ s! { pub flag: *mut ::c_int, pub val: ::c_int, } -} -s_no_extra_traits! { pub struct sockaddr_un { pub sun_len: u8, pub sun_family: sa_family_t, @@ -153,96 +151,6 @@ s_no_extra_traits! { #[cfg(target_os = "dragonfly")] pub machine: [::c_char; 32], } - -} - -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for sockaddr_un { - fn eq(&self, other: &sockaddr_un) -> bool { - self.sun_len == other.sun_len - && self.sun_family == other.sun_family - && self - .sun_path - .iter() - .zip(other.sun_path.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for sockaddr_un {} - - impl ::fmt::Debug for sockaddr_un { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_un") - .field("sun_len", &self.sun_len) - .field("sun_family", &self.sun_family) - // FIXME: .field("sun_path", &self.sun_path) - .finish() - } - } - - impl ::hash::Hash for sockaddr_un { - fn hash(&self, state: &mut H) { - self.sun_len.hash(state); - self.sun_family.hash(state); - self.sun_path.hash(state); - } - } - - impl PartialEq for utsname { - fn eq(&self, other: &utsname) -> bool { - self.sysname - .iter() - .zip(other.sysname.iter()) - .all(|(a,b)| a == b) - && self - .nodename - .iter() - .zip(other.nodename.iter()) - .all(|(a,b)| a == b) - && self - .release - .iter() - .zip(other.release.iter()) - .all(|(a,b)| a == b) - && self - .version - .iter() - .zip(other.version.iter()) - .all(|(a,b)| a == b) - && self - .machine - .iter() - .zip(other.machine.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for utsname {} - - impl ::fmt::Debug for utsname { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("utsname") - // FIXME: .field("sysname", &self.sysname) - // FIXME: .field("nodename", &self.nodename) - // FIXME: .field("release", &self.release) - // FIXME: .field("version", &self.version) - // FIXME: .field("machine", &self.machine) - .finish() - } - } - - impl ::hash::Hash for utsname { - fn hash(&self, state: &mut H) { - self.sysname.hash(state); - self.nodename.hash(state); - self.release.hash(state); - self.version.hash(state); - self.machine.hash(state); - } - } - } } pub const LC_ALL: ::c_int = 0; diff --git a/src/unix/bsd/netbsdlike/mod.rs b/src/unix/bsd/netbsdlike/mod.rs index 35a8c0255be69..972ded7ddee17 100644 --- a/src/unix/bsd/netbsdlike/mod.rs +++ b/src/unix/bsd/netbsdlike/mod.rs @@ -13,7 +13,6 @@ pub type id_t = u32; pub type sem_t = *mut sem; pub type key_t = c_long; -#[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum timezone {} impl ::Copy for timezone {} impl ::Clone for timezone { @@ -21,7 +20,6 @@ impl ::Clone for timezone { *self } } -#[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum sem {} impl ::Copy for sem {} impl ::Clone for sem { diff --git a/src/unix/bsd/netbsdlike/netbsd/aarch64.rs b/src/unix/bsd/netbsdlike/netbsd/aarch64.rs index e285d0617ce20..d3ad756397f9c 100644 --- a/src/unix/bsd/netbsdlike/netbsd/aarch64.rs +++ b/src/unix/bsd/netbsdlike/netbsd/aarch64.rs @@ -26,9 +26,7 @@ s! { pub uc_stack: ::stack_t, pub uc_mcontext: mcontext_t, } -} -s_no_extra_traits! { #[repr(align(16))] pub union __c_anonymous__freg { pub __b8: [u8; 16], @@ -39,47 +37,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for __c_anonymous__freg { - fn eq(&self, other: &__c_anonymous__freg) -> bool { - unsafe { - self.__b8 == other.__b8 - || self.__h16 == other.__h16 - || self.__s32 == other.__s32 - || self.__d64 == other.__d64 - || self.__q128 == other.__q128 - } - } - } - impl Eq for __c_anonymous__freg {} - impl ::fmt::Debug for __c_anonymous__freg { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - unsafe { - f.debug_struct("__c_anonymous__freg") - .field("__b8", &self.__b8) - .field("__h16", &self.__h16) - .field("__s32", &self.__s32) - .field("__d64", &self.__d64) - .field("__q128", &self.__q128) - .finish() - } - } - } - impl ::hash::Hash for __c_anonymous__freg { - fn hash(&self, state: &mut H) { - unsafe { - self.__b8.hash(state); - self.__h16.hash(state); - self.__s32.hash(state); - self.__d64.hash(state); - self.__q128.hash(state); - } - } - } - } -} - pub(crate) const _ALIGNBYTES: usize = ::mem::size_of::<::c_int>() - 1; pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 0; diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index 47ade8c087fd2..2605bfe9b767d 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -782,9 +782,7 @@ s! { pub tcpi_snd_zerowin: u32, pub __tcpi_pad: [u32; 26], } -} -s_no_extra_traits! { pub struct utmpx { pub ut_name: [::c_char; _UTX_USERSIZE], @@ -906,496 +904,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for utmpx { - fn eq(&self, other: &utmpx) -> bool { - self.ut_type == other.ut_type - && self.ut_pid == other.ut_pid - && self.ut_name == other.ut_name - && self.ut_line == other.ut_line - && self.ut_id == other.ut_id - && self.ut_exit == other.ut_exit - && self.ut_session == other.ut_session - && self.ut_tv == other.ut_tv - && self.ut_ss == other.ut_ss - && self - .ut_pad - .iter() - .zip(other.ut_pad.iter()) - .all(|(a,b)| a == b) - && self - .ut_host - .iter() - .zip(other.ut_host.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for utmpx {} - - impl ::fmt::Debug for utmpx { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("utmpx") - .field("ut_name", &self.ut_name) - .field("ut_id", &self.ut_id) - .field("ut_line", &self.ut_line) - // FIXME .field("ut_host", &self.ut_host) - .field("ut_session", &self.ut_session) - .field("ut_type", &self.ut_type) - .field("ut_pid", &self.ut_pid) - .field("ut_exit", &self.ut_exit) - .field("ut_ss", &self.ut_ss) - .field("ut_tv", &self.ut_tv) - // FIXME .field("ut_pad", &self.ut_pad) - .finish() - } - } - - impl ::hash::Hash for utmpx { - fn hash(&self, state: &mut H) { - self.ut_name.hash(state); - self.ut_type.hash(state); - self.ut_pid.hash(state); - self.ut_line.hash(state); - self.ut_id.hash(state); - self.ut_host.hash(state); - self.ut_exit.hash(state); - self.ut_session.hash(state); - self.ut_tv.hash(state); - self.ut_ss.hash(state); - self.ut_pad.hash(state); - } - } - - impl PartialEq for lastlogx { - fn eq(&self, other: &lastlogx) -> bool { - self.ll_tv == other.ll_tv - && self.ll_line == other.ll_line - && self.ll_ss == other.ll_ss - && self - .ll_host - .iter() - .zip(other.ll_host.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for lastlogx {} - - impl ::fmt::Debug for lastlogx { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("lastlogx") - .field("ll_tv", &self.ll_tv) - .field("ll_line", &self.ll_line) - // FIXME.field("ll_host", &self.ll_host) - .field("ll_ss", &self.ll_ss) - .finish() - } - } - - impl ::hash::Hash for lastlogx { - fn hash(&self, state: &mut H) { - self.ll_tv.hash(state); - self.ll_line.hash(state); - self.ll_host.hash(state); - self.ll_ss.hash(state); - } - } - - impl PartialEq for in_pktinfo { - fn eq(&self, other: &in_pktinfo) -> bool { - self.ipi_addr == other.ipi_addr - && self.ipi_ifindex == other.ipi_ifindex - } - } - impl Eq for in_pktinfo {} - impl ::fmt::Debug for in_pktinfo { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("in_pktinfo") - .field("ipi_addr", &self.ipi_addr) - .field("ipi_ifindex", &self.ipi_ifindex) - .finish() - } - } - impl ::hash::Hash for in_pktinfo { - fn hash(&self, state: &mut H) { - self.ipi_addr.hash(state); - self.ipi_ifindex.hash(state); - } - } - - impl PartialEq for arphdr { - fn eq(&self, other: &arphdr) -> bool { - self.ar_hrd == other.ar_hrd - && self.ar_pro == other.ar_pro - && self.ar_hln == other.ar_hln - && self.ar_pln == other.ar_pln - && self.ar_op == other.ar_op - } - } - impl Eq for arphdr {} - impl ::fmt::Debug for arphdr { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let ar_hrd = self.ar_hrd; - let ar_pro = self.ar_pro; - let ar_op = self.ar_op; - f.debug_struct("arphdr") - .field("ar_hrd", &ar_hrd) - .field("ar_pro", &ar_pro) - .field("ar_hln", &self.ar_hln) - .field("ar_pln", &self.ar_pln) - .field("ar_op", &ar_op) - .finish() - } - } - impl ::hash::Hash for arphdr { - fn hash(&self, state: &mut H) { - let ar_hrd = self.ar_hrd; - let ar_pro = self.ar_pro; - let ar_op = self.ar_op; - ar_hrd.hash(state); - ar_pro.hash(state); - self.ar_hln.hash(state); - self.ar_pln.hash(state); - ar_op.hash(state); - } - } - - impl PartialEq for in_addr { - fn eq(&self, other: &in_addr) -> bool { - self.s_addr == other.s_addr - } - } - impl Eq for in_addr {} - impl ::fmt::Debug for in_addr { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let s_addr = self.s_addr; - f.debug_struct("in_addr") - .field("s_addr", &s_addr) - .finish() - } - } - impl ::hash::Hash for in_addr { - fn hash(&self, state: &mut H) { - let s_addr = self.s_addr; - s_addr.hash(state); - } - } - - impl PartialEq for ip_mreq { - fn eq(&self, other: &ip_mreq) -> bool { - self.imr_multiaddr == other.imr_multiaddr - && self.imr_interface == other.imr_interface - } - } - impl Eq for ip_mreq {} - impl ::fmt::Debug for ip_mreq { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ip_mreq") - .field("imr_multiaddr", &self.imr_multiaddr) - .field("imr_interface", &self.imr_interface) - .finish() - } - } - impl ::hash::Hash for ip_mreq { - fn hash(&self, state: &mut H) { - self.imr_multiaddr.hash(state); - self.imr_interface.hash(state); - } - } - - impl PartialEq for sockaddr_in { - fn eq(&self, other: &sockaddr_in) -> bool { - self.sin_len == other.sin_len - && self.sin_family == other.sin_family - && self.sin_port == other.sin_port - && self.sin_addr == other.sin_addr - && self.sin_zero == other.sin_zero - } - } - impl Eq for sockaddr_in {} - impl ::fmt::Debug for sockaddr_in { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_in") - .field("sin_len", &self.sin_len) - .field("sin_family", &self.sin_family) - .field("sin_port", &self.sin_port) - .field("sin_addr", &self.sin_addr) - .field("sin_zero", &self.sin_zero) - .finish() - } - } - impl ::hash::Hash for sockaddr_in { - fn hash(&self, state: &mut H) { - self.sin_len.hash(state); - self.sin_family.hash(state); - self.sin_port.hash(state); - self.sin_addr.hash(state); - self.sin_zero.hash(state); - } - } - - impl PartialEq for dirent { - fn eq(&self, other: &dirent) -> bool { - self.d_fileno == other.d_fileno - && self.d_reclen == other.d_reclen - && self.d_namlen == other.d_namlen - && self.d_type == other.d_type - && self - .d_name - .iter() - .zip(other.d_name.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for dirent {} - impl ::fmt::Debug for dirent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("dirent") - .field("d_fileno", &self.d_fileno) - .field("d_reclen", &self.d_reclen) - .field("d_namlen", &self.d_namlen) - .field("d_type", &self.d_type) - // FIXME: .field("d_name", &self.d_name) - .finish() - } - } - impl ::hash::Hash for dirent { - fn hash(&self, state: &mut H) { - self.d_fileno.hash(state); - self.d_reclen.hash(state); - self.d_namlen.hash(state); - self.d_type.hash(state); - self.d_name.hash(state); - } - } - - impl PartialEq for statvfs { - fn eq(&self, other: &statvfs) -> bool { - self.f_flag == other.f_flag - && self.f_bsize == other.f_bsize - && self.f_frsize == other.f_frsize - && self.f_iosize == other.f_iosize - && self.f_blocks == other.f_blocks - && self.f_bfree == other.f_bfree - && self.f_bavail == other.f_bavail - && self.f_bresvd == other.f_bresvd - && self.f_files == other.f_files - && self.f_ffree == other.f_ffree - && self.f_favail == other.f_favail - && self.f_fresvd == other.f_fresvd - && self.f_syncreads == other.f_syncreads - && self.f_syncwrites == other.f_syncwrites - && self.f_asyncreads == other.f_asyncreads - && self.f_asyncwrites == other.f_asyncwrites - && self.f_fsidx == other.f_fsidx - && self.f_fsid == other.f_fsid - && self.f_namemax == other.f_namemax - && self.f_owner == other.f_owner - && self.f_spare == other.f_spare - && self.f_fstypename == other.f_fstypename - && self - .f_mntonname - .iter() - .zip(other.f_mntonname.iter()) - .all(|(a,b)| a == b) - && self - .f_mntfromname - .iter() - .zip(other.f_mntfromname.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for statvfs {} - impl ::fmt::Debug for statvfs { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("statvfs") - .field("f_flag", &self.f_flag) - .field("f_bsize", &self.f_bsize) - .field("f_frsize", &self.f_frsize) - .field("f_iosize", &self.f_iosize) - .field("f_blocks", &self.f_blocks) - .field("f_bfree", &self.f_bfree) - .field("f_bavail", &self.f_bavail) - .field("f_bresvd", &self.f_bresvd) - .field("f_files", &self.f_files) - .field("f_ffree", &self.f_ffree) - .field("f_favail", &self.f_favail) - .field("f_fresvd", &self.f_fresvd) - .field("f_syncreads", &self.f_syncreads) - .field("f_syncwrites", &self.f_syncwrites) - .field("f_asyncreads", &self.f_asyncreads) - .field("f_asyncwrites", &self.f_asyncwrites) - .field("f_fsidx", &self.f_fsidx) - .field("f_fsid", &self.f_fsid) - .field("f_namemax", &self.f_namemax) - .field("f_owner", &self.f_owner) - .field("f_spare", &self.f_spare) - .field("f_fstypename", &self.f_fstypename) - // FIXME: .field("f_mntonname", &self.f_mntonname) - // FIXME: .field("f_mntfromname", &self.f_mntfromname) - .finish() - } - } - impl ::hash::Hash for statvfs { - fn hash(&self, state: &mut H) { - self.f_flag.hash(state); - self.f_bsize.hash(state); - self.f_frsize.hash(state); - self.f_iosize.hash(state); - self.f_blocks.hash(state); - self.f_bfree.hash(state); - self.f_bavail.hash(state); - self.f_bresvd.hash(state); - self.f_files.hash(state); - self.f_ffree.hash(state); - self.f_favail.hash(state); - self.f_fresvd.hash(state); - self.f_syncreads.hash(state); - self.f_syncwrites.hash(state); - self.f_asyncreads.hash(state); - self.f_asyncwrites.hash(state); - self.f_fsidx.hash(state); - self.f_fsid.hash(state); - self.f_namemax.hash(state); - self.f_owner.hash(state); - self.f_spare.hash(state); - self.f_fstypename.hash(state); - self.f_mntonname.hash(state); - self.f_mntfromname.hash(state); - } - } - - impl PartialEq for sockaddr_storage { - fn eq(&self, other: &sockaddr_storage) -> bool { - self.ss_len == other.ss_len - && self.ss_family == other.ss_family - && self.__ss_pad1 == other.__ss_pad1 - && self.__ss_pad2 == other.__ss_pad2 - && self - .__ss_pad3 - .iter() - .zip(other.__ss_pad3.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for sockaddr_storage {} - impl ::fmt::Debug for sockaddr_storage { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_storage") - .field("ss_len", &self.ss_len) - .field("ss_family", &self.ss_family) - .field("__ss_pad1", &self.__ss_pad1) - .field("__ss_pad2", &self.__ss_pad2) - // FIXME: .field("__ss_pad3", &self.__ss_pad3) - .finish() - } - } - impl ::hash::Hash for sockaddr_storage { - fn hash(&self, state: &mut H) { - self.ss_len.hash(state); - self.ss_family.hash(state); - self.__ss_pad1.hash(state); - self.__ss_pad2.hash(state); - self.__ss_pad3.hash(state); - } - } - - impl PartialEq for sigevent { - fn eq(&self, other: &sigevent) -> bool { - self.sigev_notify == other.sigev_notify - && self.sigev_signo == other.sigev_signo - && self.sigev_value == other.sigev_value - && self.sigev_notify_attributes - == other.sigev_notify_attributes - } - } - impl Eq for sigevent {} - impl ::fmt::Debug for sigevent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sigevent") - .field("sigev_notify", &self.sigev_notify) - .field("sigev_signo", &self.sigev_signo) - .field("sigev_value", &self.sigev_value) - .field("sigev_notify_attributes", - &self.sigev_notify_attributes) - .finish() - } - } - impl ::hash::Hash for sigevent { - fn hash(&self, state: &mut H) { - self.sigev_notify.hash(state); - self.sigev_signo.hash(state); - self.sigev_value.hash(state); - self.sigev_notify_attributes.hash(state); - } - } - - impl Eq for __c_anonymous_posix_spawn_fae {} - - impl PartialEq for __c_anonymous_posix_spawn_fae { - fn eq(&self, other: &__c_anonymous_posix_spawn_fae) -> bool { - unsafe { - self.open == other.open - || self.dup2 == other.dup2 - } - } - } - - impl ::fmt::Debug for __c_anonymous_posix_spawn_fae { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - unsafe { - f.debug_struct("__c_anonymous_posix_fae") - .field("open", &self.open) - .field("dup2", &self.dup2) - .finish() - } - } - } - - impl ::hash::Hash for __c_anonymous_posix_spawn_fae { - fn hash(&self, state: &mut H) { - unsafe { - self.open.hash(state); - self.dup2.hash(state); - } - } - } - - impl Eq for __c_anonymous_ifc_ifcu {} - - impl PartialEq for __c_anonymous_ifc_ifcu { - fn eq(&self, other: &__c_anonymous_ifc_ifcu) -> bool { - unsafe { - self.ifcu_buf == other.ifcu_buf - || self.ifcu_req == other.ifcu_req - } - } - } - - impl ::fmt::Debug for __c_anonymous_ifc_ifcu { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - unsafe { - f.debug_struct("__c_anonymous_ifc_ifcu") - .field("ifcu_buf", &self.ifcu_buf) - .field("ifcu_req", &self.ifcu_req) - .finish() - } - } - } - - impl ::hash::Hash for __c_anonymous_ifc_ifcu { - fn hash(&self, state: &mut H) { - unsafe { - self.ifcu_buf.hash(state); - self.ifcu_req.hash(state); - } - } - } - } -} - pub const AT_FDCWD: ::c_int = -100; pub const AT_EACCESS: ::c_int = 0x100; pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x200; diff --git a/src/unix/bsd/netbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsd/mod.rs index 357662547b8e3..3267c11f65ed6 100644 --- a/src/unix/bsd/netbsdlike/openbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/openbsd/mod.rs @@ -604,62 +604,7 @@ s! { pub tcpi_so_snd_sb_lowat: u32, pub tcpi_so_snd_sb_wat: u32, } -} - -impl siginfo_t { - pub unsafe fn si_addr(&self) -> *mut ::c_char { - self.si_addr - } - - pub unsafe fn si_code(&self) -> ::c_int { - self.si_code - } - - pub unsafe fn si_errno(&self) -> ::c_int { - self.si_errno - } - - pub unsafe fn si_pid(&self) -> ::pid_t { - #[repr(C)] - struct siginfo_timer { - _si_signo: ::c_int, - _si_code: ::c_int, - _si_errno: ::c_int, - _pad: [::c_int; SI_PAD], - _pid: ::pid_t, - } - (*(self as *const siginfo_t as *const siginfo_timer))._pid - } - - pub unsafe fn si_uid(&self) -> ::uid_t { - #[repr(C)] - struct siginfo_timer { - _si_signo: ::c_int, - _si_code: ::c_int, - _si_errno: ::c_int, - _pad: [::c_int; SI_PAD], - _pid: ::pid_t, - _uid: ::uid_t, - } - (*(self as *const siginfo_t as *const siginfo_timer))._uid - } - pub unsafe fn si_value(&self) -> ::sigval { - #[repr(C)] - struct siginfo_timer { - _si_signo: ::c_int, - _si_code: ::c_int, - _si_errno: ::c_int, - _pad: [::c_int; SI_PAD], - _pid: ::pid_t, - _uid: ::uid_t, - value: ::sigval, - } - (*(self as *const siginfo_t as *const siginfo_timer)).value - } -} - -s_no_extra_traits! { pub struct dirent { pub d_fileno: ::ino_t, pub d_off: ::off_t, @@ -751,358 +696,56 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for dirent { - fn eq(&self, other: &dirent) -> bool { - self.d_fileno == other.d_fileno - && self.d_off == other.d_off - && self.d_reclen == other.d_reclen - && self.d_type == other.d_type - && self.d_namlen == other.d_namlen - && self - .d_name - .iter() - .zip(other.d_name.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for dirent {} - - impl ::fmt::Debug for dirent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("dirent") - .field("d_fileno", &self.d_fileno) - .field("d_off", &self.d_off) - .field("d_reclen", &self.d_reclen) - .field("d_type", &self.d_type) - .field("d_namlen", &self.d_namlen) - // FIXME: .field("d_name", &self.d_name) - .finish() - } - } - - impl ::hash::Hash for dirent { - fn hash(&self, state: &mut H) { - self.d_fileno.hash(state); - self.d_off.hash(state); - self.d_reclen.hash(state); - self.d_type.hash(state); - self.d_namlen.hash(state); - self.d_name.hash(state); - } - } - - impl PartialEq for sockaddr_storage { - fn eq(&self, other: &sockaddr_storage) -> bool { - self.ss_len == other.ss_len - && self.ss_family == other.ss_family - } - } - - impl Eq for sockaddr_storage {} - - impl ::fmt::Debug for sockaddr_storage { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_storage") - .field("ss_len", &self.ss_len) - .field("ss_family", &self.ss_family) - .finish() - } - } - - impl ::hash::Hash for sockaddr_storage { - fn hash(&self, state: &mut H) { - self.ss_len.hash(state); - self.ss_family.hash(state); - } - } - - impl PartialEq for siginfo_t { - fn eq(&self, other: &siginfo_t) -> bool { - self.si_signo == other.si_signo - && self.si_code == other.si_code - && self.si_errno == other.si_errno - && self.si_addr == other.si_addr - } - } - - impl Eq for siginfo_t {} - - impl ::fmt::Debug for siginfo_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("siginfo_t") - .field("si_signo", &self.si_signo) - .field("si_code", &self.si_code) - .field("si_errno", &self.si_errno) - .field("si_addr", &self.si_addr) - .finish() - } - } - - impl ::hash::Hash for siginfo_t { - fn hash(&self, state: &mut H) { - self.si_signo.hash(state); - self.si_code.hash(state); - self.si_errno.hash(state); - self.si_addr.hash(state); - } - } - - impl PartialEq for lastlog { - fn eq(&self, other: &lastlog) -> bool { - self.ll_time == other.ll_time - && self - .ll_line - .iter() - .zip(other.ll_line.iter()) - .all(|(a,b)| a == b) - && self - .ll_host - .iter() - .zip(other.ll_host.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for lastlog {} - - impl ::fmt::Debug for lastlog { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("lastlog") - .field("ll_time", &self.ll_time) - // FIXME: .field("ll_line", &self.ll_line) - // FIXME: .field("ll_host", &self.ll_host) - .finish() - } - } - - impl ::hash::Hash for lastlog { - fn hash(&self, state: &mut H) { - self.ll_time.hash(state); - self.ll_line.hash(state); - self.ll_host.hash(state); - } - } - - impl PartialEq for utmp { - fn eq(&self, other: &utmp) -> bool { - self.ut_time == other.ut_time - && self - .ut_line - .iter() - .zip(other.ut_line.iter()) - .all(|(a,b)| a == b) - && self - .ut_name - .iter() - .zip(other.ut_name.iter()) - .all(|(a,b)| a == b) - && self - .ut_host - .iter() - .zip(other.ut_host.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for utmp {} - - impl ::fmt::Debug for utmp { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("utmp") - // FIXME: .field("ut_line", &self.ut_line) - // FIXME: .field("ut_name", &self.ut_name) - // FIXME: .field("ut_host", &self.ut_host) - .field("ut_time", &self.ut_time) - .finish() - } - } - - impl ::hash::Hash for utmp { - fn hash(&self, state: &mut H) { - self.ut_line.hash(state); - self.ut_name.hash(state); - self.ut_host.hash(state); - self.ut_time.hash(state); - } - } - - impl PartialEq for mount_info { - fn eq(&self, other: &mount_info) -> bool { - unsafe { - self.align - .iter() - .zip(other.align.iter()) - .all(|(a,b)| a == b) - } - } - } - - impl Eq for mount_info { } - - impl ::fmt::Debug for mount_info { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("mount_info") - // FIXME: .field("align", &self.align) - .finish() - } - } - - impl ::hash::Hash for mount_info { - fn hash(&self, state: &mut H) { - unsafe { self.align.hash(state) }; - } - } - - impl PartialEq for __c_anonymous_ifr_ifru { - fn eq(&self, other: &__c_anonymous_ifr_ifru) -> bool { - unsafe { - self.ifru_addr == other.ifru_addr - && self.ifru_dstaddr == other.ifru_dstaddr - && self.ifru_broadaddr == other.ifru_broadaddr - && self.ifru_flags == other.ifru_flags - && self.ifru_metric == other.ifru_metric - && self.ifru_vnetid == other.ifru_vnetid - && self.ifru_media == other.ifru_media - && self.ifru_data == other.ifru_data - && self.ifru_index == other.ifru_index - } - } - } +impl siginfo_t { + pub unsafe fn si_addr(&self) -> *mut ::c_char { + self.si_addr + } - impl Eq for __c_anonymous_ifr_ifru {} - - impl ::fmt::Debug for __c_anonymous_ifr_ifru { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("__c_anonymous_ifr_ifru") - .field("ifru_addr", unsafe { &self.ifru_addr }) - .field("ifru_dstaddr", unsafe { &self.ifru_dstaddr }) - .field("ifru_broadaddr", unsafe { &self.ifru_broadaddr }) - .field("ifru_flags", unsafe { &self.ifru_flags }) - .field("ifru_metric", unsafe { &self.ifru_metric }) - .field("ifru_vnetid", unsafe { &self.ifru_vnetid }) - .field("ifru_media", unsafe { &self.ifru_media }) - .field("ifru_data", unsafe { &self.ifru_data }) - .field("ifru_index", unsafe { &self.ifru_index }) - .finish() - } - } + pub unsafe fn si_code(&self) -> ::c_int { + self.si_code + } - impl ::hash::Hash for __c_anonymous_ifr_ifru { - fn hash(&self, state: &mut H) { - unsafe { - self.ifru_addr.hash(state); - self.ifru_dstaddr.hash(state); - self.ifru_broadaddr.hash(state); - self.ifru_flags.hash(state); - self.ifru_metric.hash(state); - self.ifru_vnetid.hash(state); - self.ifru_media.hash(state); - self.ifru_data.hash(state); - self.ifru_index.hash(state); - } - } - } + pub unsafe fn si_errno(&self) -> ::c_int { + self.si_errno + } - impl PartialEq for statfs { - fn eq(&self, other: &statfs) -> bool { - self.f_flags == other.f_flags - && self.f_bsize == other.f_bsize - && self.f_iosize == other.f_iosize - && self.f_blocks == other.f_blocks - && self.f_bfree == other.f_bfree - && self.f_bavail == other.f_bavail - && self.f_files == other.f_files - && self.f_ffree == other.f_ffree - && self.f_favail == other.f_favail - && self.f_syncwrites == other.f_syncwrites - && self.f_syncreads == other.f_syncreads - && self.f_asyncwrites == other.f_asyncwrites - && self.f_asyncreads == other.f_asyncreads - && self.f_fsid == other.f_fsid - && self.f_namemax == other.f_namemax - && self.f_owner == other.f_owner - && self.f_ctime == other.f_ctime - && self.f_fstypename - .iter() - .zip(other.f_fstypename.iter()) - .all(|(a,b)| a == b) - && self.f_mntonname - .iter() - .zip(other.f_mntonname.iter()) - .all(|(a,b)| a == b) - && self.f_mntfromname - .iter() - .zip(other.f_mntfromname.iter()) - .all(|(a,b)| a == b) - && self.f_mntfromspec - .iter() - .zip(other.f_mntfromspec.iter()) - .all(|(a,b)| a == b) - && self.mount_info == other.mount_info - } + pub unsafe fn si_pid(&self) -> ::pid_t { + #[repr(C)] + struct siginfo_timer { + _si_signo: ::c_int, + _si_code: ::c_int, + _si_errno: ::c_int, + _pad: [::c_int; SI_PAD], + _pid: ::pid_t, } + (*(self as *const siginfo_t as *const siginfo_timer))._pid + } - impl Eq for statfs { } - - impl ::fmt::Debug for statfs { - fn fmt(&self, f: &mut ::fmt::Formatter) - -> ::fmt::Result { - f.debug_struct("statfs") - .field("f_flags", &self.f_flags) - .field("f_bsize", &self.f_bsize) - .field("f_iosize", &self.f_iosize) - .field("f_blocks", &self.f_blocks) - .field("f_bfree", &self.f_bfree) - .field("f_bavail", &self.f_bavail) - .field("f_files", &self.f_files) - .field("f_ffree", &self.f_ffree) - .field("f_favail", &self.f_favail) - .field("f_syncwrites", &self.f_syncwrites) - .field("f_syncreads", &self.f_syncreads) - .field("f_asyncwrites", &self.f_asyncwrites) - .field("f_asyncreads", &self.f_asyncreads) - .field("f_fsid", &self.f_fsid) - .field("f_namemax", &self.f_namemax) - .field("f_owner", &self.f_owner) - .field("f_ctime", &self.f_ctime) - // FIXME: .field("f_fstypename", &self.f_fstypename) - // FIXME: .field("f_mntonname", &self.f_mntonname) - // FIXME: .field("f_mntfromname", &self.f_mntfromname) - // FIXME: .field("f_mntfromspec", &self.f_mntfromspec) - .field("mount_info", &self.mount_info) - .finish() - } + pub unsafe fn si_uid(&self) -> ::uid_t { + #[repr(C)] + struct siginfo_timer { + _si_signo: ::c_int, + _si_code: ::c_int, + _si_errno: ::c_int, + _pad: [::c_int; SI_PAD], + _pid: ::pid_t, + _uid: ::uid_t, } + (*(self as *const siginfo_t as *const siginfo_timer))._uid + } - impl ::hash::Hash for statfs { - fn hash(&self, state: &mut H) { - self.f_flags.hash(state); - self.f_bsize.hash(state); - self.f_iosize.hash(state); - self.f_blocks.hash(state); - self.f_bfree.hash(state); - self.f_bavail.hash(state); - self.f_files.hash(state); - self.f_ffree.hash(state); - self.f_favail.hash(state); - self.f_syncwrites.hash(state); - self.f_syncreads.hash(state); - self.f_asyncwrites.hash(state); - self.f_asyncreads.hash(state); - self.f_fsid.hash(state); - self.f_namemax.hash(state); - self.f_owner.hash(state); - self.f_ctime.hash(state); - self.f_fstypename.hash(state); - self.f_mntonname.hash(state); - self.f_mntfromname.hash(state); - self.f_mntfromspec.hash(state); - self.mount_info.hash(state); - } + pub unsafe fn si_value(&self) -> ::sigval { + #[repr(C)] + struct siginfo_timer { + _si_signo: ::c_int, + _si_code: ::c_int, + _si_errno: ::c_int, + _pad: [::c_int; SI_PAD], + _pid: ::pid_t, + _uid: ::uid_t, + value: ::sigval, } + (*(self as *const siginfo_t as *const siginfo_timer)).value } } diff --git a/src/unix/bsd/netbsdlike/openbsd/x86_64.rs b/src/unix/bsd/netbsdlike/openbsd/x86_64.rs index 5cc7dc1fc060f..87d7720dd15e1 100644 --- a/src/unix/bsd/netbsdlike/openbsd/x86_64.rs +++ b/src/unix/bsd/netbsdlike/openbsd/x86_64.rs @@ -38,9 +38,7 @@ s! { pub sc_mask: ::c_int, pub sc_cookie: ::c_long, } -} -s_no_extra_traits! { #[repr(packed)] pub struct fxsave64 { pub fx_fcw: u16, @@ -58,58 +56,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - // `fxsave64` is packed, so field access is unaligned. - // use {x} to create temporary storage, copy field to it, and do aligned access. - impl PartialEq for fxsave64 { - fn eq(&self, other: &fxsave64) -> bool { - return {self.fx_fcw} == {other.fx_fcw} && - {self.fx_fsw} == {other.fx_fsw} && - {self.fx_ftw} == {other.fx_ftw} && - {self.fx_fop} == {other.fx_fop} && - {self.fx_rip} == {other.fx_rip} && - {self.fx_rdp} == {other.fx_rdp} && - {self.fx_mxcsr} == {other.fx_mxcsr} && - {self.fx_mxcsr_mask} == {other.fx_mxcsr_mask} && - {self.fx_st}.iter().zip({other.fx_st}.iter()).all(|(a,b)| a == b) && - {self.fx_xmm}.iter().zip({other.fx_xmm}.iter()).all(|(a,b)| a == b) - } - } - impl Eq for fxsave64 {} - impl ::fmt::Debug for fxsave64 { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("fxsave64") - .field("fx_fcw", &{self.fx_fcw}) - .field("fx_fsw", &{self.fx_fsw}) - .field("fx_ftw", &{self.fx_ftw}) - .field("fx_fop", &{self.fx_fop}) - .field("fx_rip", &{self.fx_rip}) - .field("fx_rdp", &{self.fx_rdp}) - .field("fx_mxcsr", &{self.fx_mxcsr}) - .field("fx_mxcsr_mask", &{self.fx_mxcsr_mask}) - // FIXME: .field("fx_st", &{self.fx_st}) - // FIXME: .field("fx_xmm", &{self.fx_xmm}) - .finish() - } - } - impl ::hash::Hash for fxsave64 { - fn hash(&self, state: &mut H) { - {self.fx_fcw}.hash(state); - {self.fx_fsw}.hash(state); - {self.fx_ftw}.hash(state); - {self.fx_fop}.hash(state); - {self.fx_rip}.hash(state); - {self.fx_rdp}.hash(state); - {self.fx_mxcsr}.hash(state); - {self.fx_mxcsr_mask}.hash(state); - {self.fx_st}.hash(state); - {self.fx_xmm}.hash(state); - } - } - } -} - pub(crate) const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1; pub const _MAX_PAGE_SHIFT: u32 = 12; diff --git a/src/unix/haiku/mod.rs b/src/unix/haiku/mod.rs index dd2e129bf75cc..c92d0a6eca7b2 100644 --- a/src/unix/haiku/mod.rs +++ b/src/unix/haiku/mod.rs @@ -57,7 +57,6 @@ pub type posix_spawn_file_actions_t = *mut ::c_void; pub type StringList = _stringlist; -#[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum timezone {} impl ::Copy for timezone {} impl ::Clone for timezone { @@ -452,14 +451,13 @@ s! { pub dlpi_phdr: *const ::Elf_Phdr, pub dlpi_phnum: ::Elf_Half, } -} -s_no_extra_traits! { pub struct sockaddr_un { pub sun_len: u8, pub sun_family: sa_family_t, pub sun_path: [::c_char; 126] } + pub struct sockaddr_storage { pub ss_len: u8, pub ss_family: sa_family_t, @@ -467,6 +465,7 @@ s_no_extra_traits! { __ss_pad2: u64, __ss_pad3: [u8; 112], } + pub struct dirent { pub d_dev: dev_t, pub d_pdev: dev_t, @@ -496,188 +495,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for utmpx { - fn eq(&self, other: &utmpx) -> bool { - self.ut_type == other.ut_type - && self.ut_tv == other.ut_tv - && self.ut_id == other.ut_id - && self.ut_pid == other.ut_pid - && self.ut_user == other.ut_user - && self.ut_line == other.ut_line - && self.ut_host.iter().zip(other.ut_host.iter()).all(|(a,b)| a == b) - && self.__ut_reserved == other.__ut_reserved - } - } - - impl Eq for utmpx {} - - impl ::fmt::Debug for utmpx { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("utmpx") - .field("ut_type", &self.ut_type) - .field("ut_tv", &self.ut_tv) - .field("ut_id", &self.ut_id) - .field("ut_pid", &self.ut_pid) - .field("ut_user", &self.ut_user) - .field("ut_line", &self.ut_line) - .field("ut_host", &self.ut_host) - .field("__ut_reserved", &self.__ut_reserved) - .finish() - } - } - - impl ::hash::Hash for utmpx { - fn hash(&self, state: &mut H) { - self.ut_type.hash(state); - self.ut_tv.hash(state); - self.ut_id.hash(state); - self.ut_pid.hash(state); - self.ut_user.hash(state); - self.ut_line.hash(state); - self.ut_host.hash(state); - self.__ut_reserved.hash(state); - } - } - impl PartialEq for sockaddr_un { - fn eq(&self, other: &sockaddr_un) -> bool { - self.sun_len == other.sun_len - && self.sun_family == other.sun_family - && self - .sun_path - .iter() - .zip(other.sun_path.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for sockaddr_un {} - impl ::fmt::Debug for sockaddr_un { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_un") - .field("sun_len", &self.sun_len) - .field("sun_family", &self.sun_family) - // FIXME: .field("sun_path", &self.sun_path) - .finish() - } - } - impl ::hash::Hash for sockaddr_un { - fn hash(&self, state: &mut H) { - self.sun_len.hash(state); - self.sun_family.hash(state); - self.sun_path.hash(state); - } - } - - impl PartialEq for sockaddr_storage { - fn eq(&self, other: &sockaddr_storage) -> bool { - self.ss_len == other.ss_len - && self.ss_family == other.ss_family - && self - .__ss_pad1 - .iter() - .zip(other.__ss_pad1.iter()) - .all(|(a, b)| a == b) - && self.__ss_pad2 == other.__ss_pad2 - && self - .__ss_pad3 - .iter() - .zip(other.__ss_pad3.iter()) - .all(|(a, b)| a == b) - } - } - impl Eq for sockaddr_storage {} - impl ::fmt::Debug for sockaddr_storage { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_storage") - .field("ss_len", &self.ss_len) - .field("ss_family", &self.ss_family) - .field("__ss_pad1", &self.__ss_pad1) - .field("__ss_pad2", &self.__ss_pad2) - // FIXME: .field("__ss_pad3", &self.__ss_pad3) - .finish() - } - } - impl ::hash::Hash for sockaddr_storage { - fn hash(&self, state: &mut H) { - self.ss_len.hash(state); - self.ss_family.hash(state); - self.__ss_pad1.hash(state); - self.__ss_pad2.hash(state); - self.__ss_pad3.hash(state); - } - } - - impl PartialEq for dirent { - fn eq(&self, other: &dirent) -> bool { - self.d_dev == other.d_dev - && self.d_pdev == other.d_pdev - && self.d_ino == other.d_ino - && self.d_pino == other.d_pino - && self.d_reclen == other.d_reclen - && self - .d_name - .iter() - .zip(other.d_name.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for dirent {} - impl ::fmt::Debug for dirent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("dirent") - .field("d_dev", &self.d_dev) - .field("d_pdev", &self.d_pdev) - .field("d_ino", &self.d_ino) - .field("d_pino", &self.d_pino) - .field("d_reclen", &self.d_reclen) - // FIXME: .field("d_name", &self.d_name) - .finish() - } - } - impl ::hash::Hash for dirent { - fn hash(&self, state: &mut H) { - self.d_dev.hash(state); - self.d_pdev.hash(state); - self.d_ino.hash(state); - self.d_pino.hash(state); - self.d_reclen.hash(state); - self.d_name.hash(state); - } - } - - impl PartialEq for sigevent { - fn eq(&self, other: &sigevent) -> bool { - self.sigev_notify == other.sigev_notify - && self.sigev_signo == other.sigev_signo - && self.sigev_value == other.sigev_value - && self.sigev_notify_attributes - == other.sigev_notify_attributes - } - } - impl Eq for sigevent {} - impl ::fmt::Debug for sigevent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sigevent") - .field("sigev_notify", &self.sigev_notify) - .field("sigev_signo", &self.sigev_signo) - .field("sigev_value", &self.sigev_value) - .field("sigev_notify_attributes", - &self.sigev_notify_attributes) - .finish() - } - } - impl ::hash::Hash for sigevent { - fn hash(&self, state: &mut H) { - self.sigev_notify.hash(state); - self.sigev_signo.hash(state); - self.sigev_value.hash(state); - self.sigev_notify_attributes.hash(state); - } - } - } -} - pub const EXIT_FAILURE: ::c_int = 1; pub const EXIT_SUCCESS: ::c_int = 0; pub const RAND_MAX: ::c_int = 2147483647; diff --git a/src/unix/haiku/native.rs b/src/unix/haiku/native.rs index 07830065add00..fb936b35db40f 100644 --- a/src/unix/haiku/native.rs +++ b/src/unix/haiku/native.rs @@ -457,9 +457,7 @@ s! { pub edx: u32, pub ecx: u32, } -} -s_no_extra_traits! { pub union cpuid_info { pub eax_0: __c_anonymous_eax_0, pub eax_1: __c_anonymous_eax_1, @@ -483,79 +481,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for cpuid_info { - fn eq(&self, other: &cpuid_info) -> bool { - unsafe { - self.eax_0 == other.eax_0 - || self.eax_1 == other.eax_1 - || self.eax_2 == other.eax_2 - || self.eax_3 == other.eax_3 - || self.as_chars == other.as_chars - || self.regs == other.regs - } - } - } - impl Eq for cpuid_info {} - impl ::fmt::Debug for cpuid_info { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - unsafe { - f.debug_struct("cpuid_info") - .field("eax_0", &self.eax_0) - .field("eax_1", &self.eax_1) - .field("eax_2", &self.eax_2) - .field("eax_3", &self.eax_3) - .field("as_chars", &self.as_chars) - .field("regs", &self.regs) - .finish() - } - } - } - - impl PartialEq for __c_anonymous_cpu_topology_info_data { - fn eq(&self, other: &__c_anonymous_cpu_topology_info_data) -> bool { - unsafe { - self.root == other.root - || self.package == other.package - || self.core == other.core - } - } - } - impl Eq for __c_anonymous_cpu_topology_info_data {} - impl ::fmt::Debug for __c_anonymous_cpu_topology_info_data { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - unsafe { - f.debug_struct("__c_anonymous_cpu_topology_info_data") - .field("root", &self.root) - .field("package", &self.package) - .field("core", &self.core) - .finish() - } - } - } - - impl PartialEq for cpu_topology_node_info { - fn eq(&self, other: &cpu_topology_node_info) -> bool { - self.id == other.id - && self.type_ == other.type_ - && self.level == other.level - } - } - - impl Eq for cpu_topology_node_info {} - impl ::fmt::Debug for cpu_topology_node_info { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("cpu_topology_node_info") - .field("id", &self.id) - .field("type", &self.type_) - .field("level", &self.level) - .finish() - } - } - } -} - // kernel/OS.h pub const B_OS_NAME_LENGTH: usize = 32; pub const B_PAGE_SIZE: usize = 4096; diff --git a/src/unix/haiku/x86_64.rs b/src/unix/haiku/x86_64.rs index 1b0462f204632..a34019d61ec8f 100644 --- a/src/unix/haiku/x86_64.rs +++ b/src/unix/haiku/x86_64.rs @@ -1,4 +1,4 @@ -s_no_extra_traits! { +s! { pub struct fpu_state { pub control: ::c_ushort, pub status: ::c_ushort, @@ -54,211 +54,3 @@ s_no_extra_traits! { pub uc_mcontext: mcontext_t, } } - -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for fpu_state { - fn eq(&self, other: &fpu_state) -> bool { - self.control == other.control - && self.status == other.status - && self.tag == other.tag - && self.opcode == other.opcode - && self.rip == other.rip - && self.rdp == other.rdp - && self.mxcsr == other.mxcsr - && self.mscsr_mask == other.mscsr_mask - && self._fpreg.iter().zip(other._fpreg.iter()).all(|(a, b)| a == b) - && self._xmm.iter().zip(other._xmm.iter()).all(|(a, b)| a == b) - && self._reserved_416_511. - iter(). - zip(other._reserved_416_511.iter()). - all(|(a, b)| a == b) - } - } - impl Eq for fpu_state {} - impl ::fmt::Debug for fpu_state { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("fpu_state") - .field("control", &self.control) - .field("status", &self.status) - .field("tag", &self.tag) - .field("opcode", &self.opcode) - .field("rip", &self.rip) - .field("rdp", &self.rdp) - .field("mxcsr", &self.mxcsr) - .field("mscsr_mask", &self.mscsr_mask) - // FIXME: .field("_fpreg", &self._fpreg) - // FIXME: .field("_xmm", &self._xmm) - // FIXME: .field("_reserved_416_511", &self._reserved_416_511) - .finish() - } - } - impl ::hash::Hash for fpu_state { - fn hash(&self, state: &mut H) { - self.control.hash(state); - self.status.hash(state); - self.tag.hash(state); - self.opcode.hash(state); - self.rip.hash(state); - self.rdp.hash(state); - self.mxcsr.hash(state); - self.mscsr_mask.hash(state); - self._fpreg.hash(state); - self._xmm.hash(state); - self._reserved_416_511.hash(state); - } - } - - impl PartialEq for xstate_hdr { - fn eq(&self, other: &xstate_hdr) -> bool { - self.bv == other.bv - && self.xcomp_bv == other.xcomp_bv - && self._reserved.iter().zip(other._reserved.iter()).all(|(a, b)| a == b) - } - } - impl Eq for xstate_hdr {} - impl ::fmt::Debug for xstate_hdr { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("xstate_hdr") - .field("bv", &self.bv) - .field("xcomp_bv", &self.xcomp_bv) - // FIXME: .field("_reserved", &field._reserved) - .finish() - } - } - impl ::hash::Hash for xstate_hdr { - fn hash(&self, state: &mut H) { - self.bv.hash(state); - self.xcomp_bv.hash(state); - self._reserved.hash(state); - } - } - - impl PartialEq for savefpu { - fn eq(&self, other: &savefpu) -> bool { - self.fp_fxsave == other.fp_fxsave - && self.fp_xstate == other.fp_xstate - && self._fp_ymm.iter().zip(other._fp_ymm.iter()).all(|(a, b)| a == b) - } - } - impl Eq for savefpu {} - impl ::fmt::Debug for savefpu { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("savefpu") - .field("fp_fxsave", &self.fp_fxsave) - .field("fp_xstate", &self.fp_xstate) - // FIXME: .field("_fp_ymm", &field._fp_ymm) - .finish() - } - } - impl ::hash::Hash for savefpu { - fn hash(&self, state: &mut H) { - self.fp_fxsave.hash(state); - self.fp_xstate.hash(state); - self._fp_ymm.hash(state); - } - } - - impl PartialEq for mcontext_t { - fn eq(&self, other: &mcontext_t) -> bool { - self.rax == other.rax - && self.rbx == other.rbx - && self.rbx == other.rbx - && self.rcx == other.rcx - && self.rdx == other.rdx - && self.rdi == other.rdi - && self.rsi == other.rsi - && self.r8 == other.r8 - && self.r9 == other.r9 - && self.r10 == other.r10 - && self.r11 == other.r11 - && self.r12 == other.r12 - && self.r13 == other.r13 - && self.r14 == other.r14 - && self.r15 == other.r15 - && self.rsp == other.rsp - && self.rip == other.rip - && self.rflags == other.rflags - && self.fpu == other.fpu - } - } - impl Eq for mcontext_t {} - impl ::fmt::Debug for mcontext_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("mcontext_t") - .field("rax", &self.rax) - .field("rbx", &self.rbx) - .field("rcx", &self.rcx) - .field("rdx", &self.rdx) - .field("rdi", &self.rdi) - .field("rsi", &self.rsi) - .field("rbp", &self.rbp) - .field("r8", &self.r8) - .field("r9", &self.r9) - .field("r10", &self.r10) - .field("r11", &self.r11) - .field("r12", &self.r12) - .field("r13", &self.r13) - .field("r14", &self.r14) - .field("r15", &self.r15) - .field("rsp", &self.rsp) - .field("rip", &self.rip) - .field("rflags", &self.rflags) - .field("fpu", &self.fpu) - .finish() - - } - } - impl ::hash::Hash for mcontext_t { - fn hash(&self, state: &mut H) { - self.rax.hash(state); - self.rbx.hash(state); - self.rcx.hash(state); - self.rdx.hash(state); - self.rdi.hash(state); - self.rsi.hash(state); - self.rbp.hash(state); - self.r8.hash(state); - self.r9.hash(state); - self.r10.hash(state); - self.r11.hash(state); - self.r12.hash(state); - self.r13.hash(state); - self.r14.hash(state); - self.r15.hash(state); - self.rsp.hash(state); - self.rip.hash(state); - self.rflags.hash(state); - self.fpu.hash(state); - } - } - - impl PartialEq for ucontext_t { - fn eq(&self, other: &ucontext_t) -> bool { - self.uc_link == other.uc_link - && self.uc_sigmask == other.uc_sigmask - && self.uc_stack == other.uc_stack - && self.uc_mcontext == other.uc_mcontext - } - } - impl Eq for ucontext_t {} - impl ::fmt::Debug for ucontext_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ucontext_t") - .field("uc_link", &self.uc_link) - .field("uc_sigmask", &self.uc_sigmask) - .field("uc_stack", &self.uc_stack) - .field("uc_mcontext", &self.uc_mcontext) - .finish() - } - } - impl ::hash::Hash for ucontext_t { - fn hash(&self, state: &mut H) { - self.uc_link.hash(state); - self.uc_sigmask.hash(state); - self.uc_stack.hash(state); - self.uc_mcontext.hash(state); - } - } - } -} diff --git a/src/unix/hurd/mod.rs b/src/unix/hurd/mod.rs index 847b47843c19d..2e22671bce238 100644 --- a/src/unix/hurd/mod.rs +++ b/src/unix/hurd/mod.rs @@ -226,7 +226,6 @@ pub type nl_item = ::c_int; pub type iconv_t = *mut ::c_void; -#[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum fpos64_t {} // FIXME: fill this out with a struct impl ::Copy for fpos64_t {} impl ::Clone for fpos64_t { @@ -235,7 +234,6 @@ impl ::Clone for fpos64_t { } } -#[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum timezone {} impl ::Copy for timezone {} impl ::Clone for timezone { @@ -1033,9 +1031,6 @@ s! { pub val: ::c_int, } -} - -s_no_extra_traits! { pub struct utmpx { pub ut_type: ::c_short, pub ut_pid: ::pid_t, @@ -1065,66 +1060,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for utmpx { - fn eq(&self, other: &utmpx) -> bool { - self.ut_type == other.ut_type - && self.ut_pid == other.ut_pid - && self.ut_line == other.ut_line - && self.ut_id == other.ut_id - && self.ut_user == other.ut_user - && self - .ut_host - .iter() - .zip(other.ut_host.iter()) - .all(|(a,b)| a == b) - && self.ut_exit == other.ut_exit - && self.ut_session == other.ut_session - && self.ut_tv == other.ut_tv - && self.ut_addr_v6 == other.ut_addr_v6 - && self.__glibc_reserved == other.__glibc_reserved - } - } - - impl Eq for utmpx {} - - impl ::fmt::Debug for utmpx { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("utmpx") - .field("ut_type", &self.ut_type) - .field("ut_pid", &self.ut_pid) - .field("ut_line", &self.ut_line) - .field("ut_id", &self.ut_id) - .field("ut_user", &self.ut_user) - // FIXME: .field("ut_host", &self.ut_host) - .field("ut_exit", &self.ut_exit) - .field("ut_session", &self.ut_session) - .field("ut_tv", &self.ut_tv) - .field("ut_addr_v6", &self.ut_addr_v6) - .field("__glibc_reserved", &self.__glibc_reserved) - .finish() - } - } - - impl ::hash::Hash for utmpx { - fn hash(&self, state: &mut H) { - self.ut_type.hash(state); - self.ut_pid.hash(state); - self.ut_line.hash(state); - self.ut_id.hash(state); - self.ut_user.hash(state); - self.ut_host.hash(state); - self.ut_exit.hash(state); - self.ut_session.hash(state); - self.ut_tv.hash(state); - self.ut_addr_v6.hash(state); - self.__glibc_reserved.hash(state); - } - } - } -} - impl siginfo_t { pub unsafe fn si_addr(&self) -> *mut ::c_void { self.si_addr diff --git a/src/unix/linux_like/android/b32/arm.rs b/src/unix/linux_like/android/b32/arm.rs index 26bfed18aba99..68dfb2ba4fab7 100644 --- a/src/unix/linux_like/android/b32/arm.rs +++ b/src/unix/linux_like/android/b32/arm.rs @@ -27,9 +27,7 @@ s! { pub arm_cpsr: ::c_ulong, pub fault_address: ::c_ulong, } -} -s_no_extra_traits! { pub struct __c_anonymous_uc_sigmask_with_padding { pub uc_sigmask: ::sigset_t, /* Android has a wrong (smaller) sigset_t on x86. */ @@ -55,94 +53,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for __c_anonymous_uc_sigmask_with_padding { - fn eq( - &self, other: &__c_anonymous_uc_sigmask_with_padding - ) -> bool { - self.uc_sigmask == other.uc_sigmask - // Ignore padding - } - } - impl Eq for __c_anonymous_uc_sigmask_with_padding {} - impl ::fmt::Debug for __c_anonymous_uc_sigmask_with_padding { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("uc_sigmask_with_padding") - .field("uc_sigmask_with_padding", &self.uc_sigmask) - // Ignore padding - .finish() - } - } - impl ::hash::Hash for __c_anonymous_uc_sigmask_with_padding { - fn hash(&self, state: &mut H) { - self.uc_sigmask.hash(state) - // Ignore padding - } - } - - impl PartialEq for __c_anonymous_uc_sigmask { - fn eq(&self, other: &__c_anonymous_uc_sigmask) -> bool { - unsafe { self.uc_sigmask == other.uc_sigmask } - } - } - impl Eq for __c_anonymous_uc_sigmask {} - impl ::fmt::Debug for __c_anonymous_uc_sigmask { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("uc_sigmask") - .field("uc_sigmask", unsafe { &self.uc_sigmask }) - .finish() - } - } - impl ::hash::Hash for __c_anonymous_uc_sigmask { - fn hash(&self, state: &mut H) { - unsafe { self.uc_sigmask.hash(state) } - } - } - - impl PartialEq for ucontext_t { - fn eq(&self, other: &Self) -> bool { - self.uc_flags == other.uc_flags - && self.uc_link == other.uc_link - && self.uc_stack == other.uc_stack - && self.uc_mcontext == other.uc_mcontext - && self.uc_sigmask__c_anonymous_union - == other.uc_sigmask__c_anonymous_union - && &self.uc_regspace[..] == &other.uc_regspace[..] - // Ignore padding field - } - } - impl Eq for ucontext_t {} - impl ::fmt::Debug for ucontext_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ucontext_t") - .field("uc_flags", &self.uc_flags) - .field("uc_link", &self.uc_link) - .field("uc_stack", &self.uc_stack) - .field("uc_mcontext", &self.uc_mcontext) - .field( - "uc_sigmask__c_anonymous_union", - &self.uc_sigmask__c_anonymous_union - ) - .field("uc_regspace", &&self.uc_regspace[..]) - // Ignore padding field - .finish() - } - } - impl ::hash::Hash for ucontext_t { - fn hash(&self, state: &mut H) { - self.uc_flags.hash(state); - self.uc_link.hash(state); - self.uc_stack.hash(state); - self.uc_mcontext.hash(state); - self.uc_sigmask__c_anonymous_union.hash(state); - self.uc_regspace[..].hash(state); - // Ignore padding field - } - } - } -} - pub const O_DIRECT: ::c_int = 0x10000; pub const O_DIRECTORY: ::c_int = 0x4000; pub const O_NOFOLLOW: ::c_int = 0x8000; diff --git a/src/unix/linux_like/android/b32/mod.rs b/src/unix/linux_like/android/b32/mod.rs index aa29267f9db50..4bd0c133778b0 100644 --- a/src/unix/linux_like/android/b32/mod.rs +++ b/src/unix/linux_like/android/b32/mod.rs @@ -169,26 +169,12 @@ s! { pub mem_unit: ::c_uint, pub _f: [::c_char; 8], } -} -s_no_extra_traits! { pub struct sigset64_t { __bits: [::c_ulong; 2] } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl ::fmt::Debug for sigset64_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sigset64_t") - .field("__bits", &self.__bits) - .finish() - } - } - } -} - // These constants must be of the same type of sigaction.sa_flags pub const SA_NOCLDSTOP: ::c_int = 0x00000001; pub const SA_NOCLDWAIT: ::c_int = 0x00000002; diff --git a/src/unix/linux_like/android/b32/x86/align.rs b/src/unix/linux_like/android/b32/x86/align.rs index 04df4a05d19b7..50c79983739f5 100644 --- a/src/unix/linux_like/android/b32/x86/align.rs +++ b/src/unix/linux_like/android/b32/x86/align.rs @@ -1,5 +1,4 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] +s! { #[repr(align(8))] pub struct max_align_t { priv_: [f64; 2] diff --git a/src/unix/linux_like/android/b32/x86/mod.rs b/src/unix/linux_like/android/b32/x86/mod.rs index feec5ce6606a4..3b82ae964f469 100644 --- a/src/unix/linux_like/android/b32/x86/mod.rs +++ b/src/unix/linux_like/android/b32/x86/mod.rs @@ -26,9 +26,7 @@ s! { pub oldmask: ::c_ulong, pub cr2: ::c_ulong, } -} -s_no_extra_traits! { pub struct __c_anonymous_uc_sigmask_with_padding { pub uc_sigmask: ::sigset_t, /* Android has a wrong (smaller) sigset_t on x86. */ @@ -51,91 +49,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for __c_anonymous_uc_sigmask_with_padding { - fn eq( - &self, other: &__c_anonymous_uc_sigmask_with_padding - ) -> bool { - self.uc_sigmask == other.uc_sigmask - // Ignore padding - } - } - impl Eq for __c_anonymous_uc_sigmask_with_padding {} - impl ::fmt::Debug for __c_anonymous_uc_sigmask_with_padding { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("uc_sigmask_with_padding") - .field("uc_sigmask_with_padding", &self.uc_sigmask) - // Ignore padding - .finish() - } - } - impl ::hash::Hash for __c_anonymous_uc_sigmask_with_padding { - fn hash(&self, state: &mut H) { - self.uc_sigmask.hash(state) - // Ignore padding - } - } - - impl PartialEq for __c_anonymous_uc_sigmask { - fn eq(&self, other: &__c_anonymous_uc_sigmask) -> bool { - unsafe { self.uc_sigmask == other.uc_sigmask } - } - } - impl Eq for __c_anonymous_uc_sigmask {} - impl ::fmt::Debug for __c_anonymous_uc_sigmask { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("uc_sigmask") - .field("uc_sigmask", unsafe { &self.uc_sigmask }) - .finish() - } - } - impl ::hash::Hash for __c_anonymous_uc_sigmask { - fn hash(&self, state: &mut H) { - unsafe { self.uc_sigmask.hash(state) } - } - } - - impl PartialEq for ucontext_t { - fn eq(&self, other: &Self) -> bool { - self.uc_flags == other.uc_flags - && self.uc_link == other.uc_link - && self.uc_stack == other.uc_stack - && self.uc_mcontext == other.uc_mcontext - && self.uc_sigmask__c_anonymous_union - == other.uc_sigmask__c_anonymous_union - // Ignore padding field - } - } - impl Eq for ucontext_t {} - impl ::fmt::Debug for ucontext_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ucontext_t") - .field("uc_flags", &self.uc_flags) - .field("uc_link", &self.uc_link) - .field("uc_stack", &self.uc_stack) - .field("uc_mcontext", &self.uc_mcontext) - .field( - "uc_sigmask__c_anonymous_union", - &self.uc_sigmask__c_anonymous_union - ) - // Ignore padding field - .finish() - } - } - impl ::hash::Hash for ucontext_t { - fn hash(&self, state: &mut H) { - self.uc_flags.hash(state); - self.uc_link.hash(state); - self.uc_stack.hash(state); - self.uc_mcontext.hash(state); - self.uc_sigmask__c_anonymous_union.hash(state); - // Ignore padding field - } - } - } -} - pub const O_DIRECT: ::c_int = 0x4000; pub const O_DIRECTORY: ::c_int = 0x10000; pub const O_NOFOLLOW: ::c_int = 0x20000; diff --git a/src/unix/linux_like/android/b64/aarch64/align.rs b/src/unix/linux_like/android/b64/aarch64/align.rs index 154c2c54ce6de..2c74ee8ff5f8a 100644 --- a/src/unix/linux_like/android/b64/aarch64/align.rs +++ b/src/unix/linux_like/android/b64/aarch64/align.rs @@ -1,12 +1,9 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] +s! { #[repr(align(16))] pub struct max_align_t { priv_: [f32; 8] } -} -s! { pub struct ucontext_t { pub uc_flags: ::c_ulong, pub uc_link: *mut ucontext_t, diff --git a/src/unix/linux_like/android/b64/mod.rs b/src/unix/linux_like/android/b64/mod.rs index 67d0dacf17e93..79e56651eec46 100644 --- a/src/unix/linux_like/android/b64/mod.rs +++ b/src/unix/linux_like/android/b64/mod.rs @@ -113,9 +113,7 @@ s! { pub struct pthread_spinlock_t { __private: i64, } -} -s_no_extra_traits! { pub struct pthread_mutex_t { value: ::c_int, __reserved: [::c_char; 36], @@ -140,117 +138,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for pthread_mutex_t { - fn eq(&self, other: &pthread_mutex_t) -> bool { - self.value == other.value - && self - .__reserved - .iter() - .zip(other.__reserved.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for pthread_mutex_t {} - - impl ::fmt::Debug for pthread_mutex_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("pthread_mutex_t") - .field("value", &self.value) - // FIXME: .field("__reserved", &self.__reserved) - .finish() - } - } - - impl ::hash::Hash for pthread_mutex_t { - fn hash(&self, state: &mut H) { - self.value.hash(state); - self.__reserved.hash(state); - } - } - - impl PartialEq for pthread_cond_t { - fn eq(&self, other: &pthread_cond_t) -> bool { - self.value == other.value - && self - .__reserved - .iter() - .zip(other.__reserved.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for pthread_cond_t {} - - impl ::fmt::Debug for pthread_cond_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("pthread_cond_t") - .field("value", &self.value) - // FIXME: .field("__reserved", &self.__reserved) - .finish() - } - } - - impl ::hash::Hash for pthread_cond_t { - fn hash(&self, state: &mut H) { - self.value.hash(state); - self.__reserved.hash(state); - } - } - - impl PartialEq for pthread_rwlock_t { - fn eq(&self, other: &pthread_rwlock_t) -> bool { - self.numLocks == other.numLocks - && self.writerThreadId == other.writerThreadId - && self.pendingReaders == other.pendingReaders - && self.pendingWriters == other.pendingWriters - && self.attr == other.attr - && self - .__reserved - .iter() - .zip(other.__reserved.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for pthread_rwlock_t {} - - impl ::fmt::Debug for pthread_rwlock_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("pthread_rwlock_t") - .field("numLocks", &self.numLocks) - .field("writerThreadId", &self.writerThreadId) - .field("pendingReaders", &self.pendingReaders) - .field("pendingWriters", &self.pendingWriters) - .field("attr", &self.attr) - // FIXME: .field("__reserved", &self.__reserved) - .finish() - } - } - - impl ::hash::Hash for pthread_rwlock_t { - fn hash(&self, state: &mut H) { - self.numLocks.hash(state); - self.writerThreadId.hash(state); - self.pendingReaders.hash(state); - self.pendingWriters.hash(state); - self.attr.hash(state); - self.__reserved.hash(state); - } - } - - impl ::fmt::Debug for sigset64_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sigset64_t") - .field("__bits", &self.__bits) - .finish() - } - } - } -} - // These constants must be of the same type of sigaction.sa_flags pub const SA_NOCLDSTOP: ::c_int = 0x00000001; pub const SA_NOCLDWAIT: ::c_int = 0x00000002; diff --git a/src/unix/linux_like/android/b64/riscv64/align.rs b/src/unix/linux_like/android/b64/riscv64/align.rs index 8e949963a637f..265118d83c4c8 100644 --- a/src/unix/linux_like/android/b64/riscv64/align.rs +++ b/src/unix/linux_like/android/b64/riscv64/align.rs @@ -1,5 +1,4 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] +s! { #[repr(align(16))] pub struct max_align_t { priv_: [f32; 8] diff --git a/src/unix/linux_like/android/b64/x86_64/align.rs b/src/unix/linux_like/android/b64/x86_64/align.rs index 7ca870fd02b71..340ad79821862 100644 --- a/src/unix/linux_like/android/b64/x86_64/align.rs +++ b/src/unix/linux_like/android/b64/x86_64/align.rs @@ -1,5 +1,4 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] +s! { #[repr(align(16))] pub struct max_align_t { priv_: [f64; 4] diff --git a/src/unix/linux_like/android/b64/x86_64/mod.rs b/src/unix/linux_like/android/b64/x86_64/mod.rs index 9062e2feea701..a6222a972d2a6 100644 --- a/src/unix/linux_like/android/b64/x86_64/mod.rs +++ b/src/unix/linux_like/android/b64/x86_64/mod.rs @@ -103,39 +103,11 @@ s! { pub fault_address: ::c_ulong, } -} - -s_no_extra_traits! { pub union __c_anonymous_uc_sigmask { uc_sigmask: ::sigset_t, uc_sigmask64: ::sigset64_t, } -} - -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for __c_anonymous_uc_sigmask { - fn eq(&self, other: &__c_anonymous_uc_sigmask) -> bool { - unsafe { self.uc_sigmask == other.uc_sigmask } - } - } - impl Eq for __c_anonymous_uc_sigmask {} - impl ::fmt::Debug for __c_anonymous_uc_sigmask { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("uc_sigmask") - .field("uc_sigmask", unsafe { &self.uc_sigmask }) - .finish() - } - } - impl ::hash::Hash for __c_anonymous_uc_sigmask { - fn hash(&self, state: &mut H) { - unsafe { self.uc_sigmask.hash(state) } - } - } - } -} -s_no_extra_traits! { pub struct _libc_fpxreg { pub significand: [u16; 4], pub exponent: u16, @@ -186,199 +158,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for _libc_fpxreg { - fn eq(&self, other: &Self) -> bool { - self.significand == other.significand - && self.exponent == other.exponent - // Ignore padding field - } - } - impl Eq for _libc_fpxreg {} - impl ::fmt::Debug for _libc_fpxreg { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("_libc_fpxreg") - .field("significand", &self.significand) - .field("exponent", &self.exponent) - // Ignore padding field - .finish() - } - } - impl ::hash::Hash for _libc_fpxreg { - fn hash(&self, state: &mut H) { - self.significand.hash(state); - self.exponent.hash(state); - // Ignore padding field - } - } - - impl PartialEq for _libc_fpstate { - fn eq(&self, other: &Self) -> bool { - self.cwd == other.cwd - && self.swd == other.swd - && self.ftw == other.ftw - && self.fop == other.fop - && self.rip == other.rip - && self.rdp == other.rdp - && self.mxcsr == other.mxcsr - && self.mxcr_mask == other.mxcr_mask - && self._st == other._st - && self._xmm == other._xmm - // Ignore padding field - } - } - impl Eq for _libc_fpstate {} - impl ::fmt::Debug for _libc_fpstate { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("_libc_fpstate") - .field("cwd", &self.cwd) - .field("swd", &self.swd) - .field("ftw", &self.ftw) - .field("fop", &self.fop) - .field("rip", &self.rip) - .field("rdp", &self.rdp) - .field("mxcsr", &self.mxcsr) - .field("mxcr_mask", &self.mxcr_mask) - .field("_st", &self._st) - .field("_xmm", &self._xmm) - // Ignore padding field - .finish() - } - } - impl ::hash::Hash for _libc_fpstate { - fn hash(&self, state: &mut H) { - self.cwd.hash(state); - self.swd.hash(state); - self.ftw.hash(state); - self.fop.hash(state); - self.rip.hash(state); - self.rdp.hash(state); - self.mxcsr.hash(state); - self.mxcr_mask.hash(state); - self._st.hash(state); - self._xmm.hash(state); - // Ignore padding field - } - } - - impl PartialEq for mcontext_t { - fn eq(&self, other: &Self) -> bool { - self.gregs == other.gregs - && self.fpregs == other.fpregs - // Ignore padding field - } - } - impl Eq for mcontext_t {} - impl ::fmt::Debug for mcontext_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("mcontext_t") - .field("gregs", &self.gregs) - .field("fpregs", &self.fpregs) - // Ignore padding field - .finish() - } - } - impl ::hash::Hash for mcontext_t { - fn hash(&self, state: &mut H) { - self.gregs.hash(state); - self.fpregs.hash(state); - // Ignore padding field - } - } - - impl PartialEq for ucontext_t { - fn eq(&self, other: &Self) -> bool { - self.uc_flags == other.uc_flags - && self.uc_link == other.uc_link - && self.uc_stack == other.uc_stack - && self.uc_mcontext == other.uc_mcontext - && self.uc_sigmask64 == other.uc_sigmask64 - // Ignore padding field - } - } - impl Eq for ucontext_t {} - impl ::fmt::Debug for ucontext_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ucontext_t") - .field("uc_flags", &self.uc_flags) - .field("uc_link", &self.uc_link) - .field("uc_stack", &self.uc_stack) - .field("uc_mcontext", &self.uc_mcontext) - .field("uc_sigmask64", &self.uc_sigmask64) - // Ignore padding field - .finish() - } - } - impl ::hash::Hash for ucontext_t { - fn hash(&self, state: &mut H) { - self.uc_flags.hash(state); - self.uc_link.hash(state); - self.uc_stack.hash(state); - self.uc_mcontext.hash(state); - self.uc_sigmask64.hash(state); - // Ignore padding field - } - } - - impl PartialEq for user_fpregs_struct { - fn eq(&self, other: &user_fpregs_struct) -> bool { - self.cwd == other.cwd - && self.swd == other.swd - && self.ftw == other.ftw - && self.fop == other.fop - && self.rip == other.rip - && self.rdp == other.rdp - && self.mxcsr == other.mxcsr - && self.mxcr_mask == other.mxcr_mask - && self.st_space == other.st_space - && self - .xmm_space - .iter() - .zip(other.xmm_space.iter()) - .all(|(a,b)| a == b) - // Ignore padding field - } - } - - impl Eq for user_fpregs_struct {} - - impl ::fmt::Debug for user_fpregs_struct { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("user_fpregs_struct") - .field("cwd", &self.cwd) - .field("swd", &self.swd) - .field("ftw", &self.ftw) - .field("fop", &self.fop) - .field("rip", &self.rip) - .field("rdp", &self.rdp) - .field("mxcsr", &self.mxcsr) - .field("mxcr_mask", &self.mxcr_mask) - .field("st_space", &self.st_space) - // FIXME: .field("xmm_space", &self.xmm_space) - // Ignore padding field - .finish() - } - } - - impl ::hash::Hash for user_fpregs_struct { - fn hash(&self, state: &mut H) { - self.cwd.hash(state); - self.swd.hash(state); - self.ftw.hash(state); - self.fop.hash(state); - self.rip.hash(state); - self.rdp.hash(state); - self.mxcsr.hash(state); - self.mxcr_mask.hash(state); - self.st_space.hash(state); - self.xmm_space.hash(state); - // Ignore padding field - } - } - } -} - pub const O_DIRECT: ::c_int = 0x4000; pub const O_DIRECTORY: ::c_int = 0x10000; pub const O_NOFOLLOW: ::c_int = 0x20000; diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index ef8c2ccaa4fde..025558cdb5fed 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -544,9 +544,7 @@ s! { pub tv_nsec: ::__u32, pub __reserved: ::__s32, } -} -s_no_extra_traits! { pub struct sockaddr_nl { pub nl_family: ::sa_family_t, nl_pad: ::c_ushort, @@ -622,7 +620,6 @@ s_no_extra_traits! { pub absflat: [::__s32; ABS_CNT], } - #[allow(missing_debug_implementations)] pub struct af_alg_iv { pub ivlen: u32, pub iv: [::c_uchar; 0], @@ -665,417 +662,6 @@ s_no_extra_traits! { pub ifc_len: ::c_int, pub ifc_ifcu: __c_anonymous_ifc_ifcu, } - -} - -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for sockaddr_nl { - fn eq(&self, other: &sockaddr_nl) -> bool { - self.nl_family == other.nl_family && - self.nl_pid == other.nl_pid && - self.nl_groups == other.nl_groups - } - } - impl Eq for sockaddr_nl {} - impl ::fmt::Debug for sockaddr_nl { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_nl") - .field("nl_family", &self.nl_family) - .field("nl_pid", &self.nl_pid) - .field("nl_groups", &self.nl_groups) - .finish() - } - } - impl ::hash::Hash for sockaddr_nl { - fn hash(&self, state: &mut H) { - self.nl_family.hash(state); - self.nl_pid.hash(state); - self.nl_groups.hash(state); - } - } - - impl PartialEq for dirent { - fn eq(&self, other: &dirent) -> bool { - self.d_ino == other.d_ino - && self.d_off == other.d_off - && self.d_reclen == other.d_reclen - && self.d_type == other.d_type - && self - .d_name - .iter() - .zip(other.d_name.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for dirent {} - - impl ::fmt::Debug for dirent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("dirent") - .field("d_ino", &self.d_ino) - .field("d_off", &self.d_off) - .field("d_reclen", &self.d_reclen) - .field("d_type", &self.d_type) - // FIXME: .field("d_name", &self.d_name) - .finish() - } - } - - impl ::hash::Hash for dirent { - fn hash(&self, state: &mut H) { - self.d_ino.hash(state); - self.d_off.hash(state); - self.d_reclen.hash(state); - self.d_type.hash(state); - self.d_name.hash(state); - } - } - - impl PartialEq for dirent64 { - fn eq(&self, other: &dirent64) -> bool { - self.d_ino == other.d_ino - && self.d_off == other.d_off - && self.d_reclen == other.d_reclen - && self.d_type == other.d_type - && self - .d_name - .iter() - .zip(other.d_name.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for dirent64 {} - - impl ::fmt::Debug for dirent64 { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("dirent64") - .field("d_ino", &self.d_ino) - .field("d_off", &self.d_off) - .field("d_reclen", &self.d_reclen) - .field("d_type", &self.d_type) - // FIXME: .field("d_name", &self.d_name) - .finish() - } - } - - impl ::hash::Hash for dirent64 { - fn hash(&self, state: &mut H) { - self.d_ino.hash(state); - self.d_off.hash(state); - self.d_reclen.hash(state); - self.d_type.hash(state); - self.d_name.hash(state); - } - } - - impl PartialEq for siginfo_t { - fn eq(&self, other: &siginfo_t) -> bool { - self.si_signo == other.si_signo - && self.si_errno == other.si_errno - && self.si_code == other.si_code - // Ignore _pad - // Ignore _align - } - } - - impl Eq for siginfo_t {} - - impl ::fmt::Debug for siginfo_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("siginfo_t") - .field("si_signo", &self.si_signo) - .field("si_errno", &self.si_errno) - .field("si_code", &self.si_code) - // Ignore _pad - // Ignore _align - .finish() - } - } - - impl ::hash::Hash for siginfo_t { - fn hash(&self, state: &mut H) { - self.si_signo.hash(state); - self.si_errno.hash(state); - self.si_code.hash(state); - // Ignore _pad - // Ignore _align - } - } - - impl PartialEq for lastlog { - fn eq(&self, other: &lastlog) -> bool { - self.ll_time == other.ll_time - && self - .ll_line - .iter() - .zip(other.ll_line.iter()) - .all(|(a,b)| a == b) - && self - .ll_host - .iter() - .zip(other.ll_host.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for lastlog {} - - impl ::fmt::Debug for lastlog { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("lastlog") - .field("ll_time", &self.ll_time) - .field("ll_line", &self.ll_line) - // FIXME: .field("ll_host", &self.ll_host) - .finish() - } - } - - impl ::hash::Hash for lastlog { - fn hash(&self, state: &mut H) { - self.ll_time.hash(state); - self.ll_line.hash(state); - self.ll_host.hash(state); - } - } - - impl PartialEq for utmp { - fn eq(&self, other: &utmp) -> bool { - self.ut_type == other.ut_type - && self.ut_pid == other.ut_pid - && self - .ut_line - .iter() - .zip(other.ut_line.iter()) - .all(|(a,b)| a == b) - && self.ut_id == other.ut_id - && self - .ut_user - .iter() - .zip(other.ut_user.iter()) - .all(|(a,b)| a == b) - && self - .ut_host - .iter() - .zip(other.ut_host.iter()) - .all(|(a,b)| a == b) - && self.ut_exit == other.ut_exit - && self.ut_session == other.ut_session - && self.ut_tv == other.ut_tv - && self.ut_addr_v6 == other.ut_addr_v6 - && self.unused == other.unused - } - } - - impl Eq for utmp {} - - impl ::fmt::Debug for utmp { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("utmp") - .field("ut_type", &self.ut_type) - .field("ut_pid", &self.ut_pid) - .field("ut_line", &self.ut_line) - .field("ut_id", &self.ut_id) - .field("ut_user", &self.ut_user) - // FIXME: .field("ut_host", &self.ut_host) - .field("ut_exit", &self.ut_exit) - .field("ut_session", &self.ut_session) - .field("ut_tv", &self.ut_tv) - .field("ut_addr_v6", &self.ut_addr_v6) - .field("unused", &self.unused) - .finish() - } - } - - impl ::hash::Hash for utmp { - fn hash(&self, state: &mut H) { - self.ut_type.hash(state); - self.ut_pid.hash(state); - self.ut_line.hash(state); - self.ut_id.hash(state); - self.ut_user.hash(state); - self.ut_host.hash(state); - self.ut_exit.hash(state); - self.ut_session.hash(state); - self.ut_tv.hash(state); - self.ut_addr_v6.hash(state); - self.unused.hash(state); - } - } - - impl PartialEq for sockaddr_alg { - fn eq(&self, other: &sockaddr_alg) -> bool { - self.salg_family == other.salg_family - && self - .salg_type - .iter() - .zip(other.salg_type.iter()) - .all(|(a, b)| a == b) - && self.salg_feat == other.salg_feat - && self.salg_mask == other.salg_mask - && self - .salg_name - .iter() - .zip(other.salg_name.iter()) - .all(|(a, b)| a == b) - } - } - - impl Eq for sockaddr_alg {} - - impl ::fmt::Debug for sockaddr_alg { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_alg") - .field("salg_family", &self.salg_family) - .field("salg_type", &self.salg_type) - .field("salg_feat", &self.salg_feat) - .field("salg_mask", &self.salg_mask) - .field("salg_name", &&self.salg_name[..]) - .finish() - } - } - - impl ::hash::Hash for sockaddr_alg { - fn hash(&self, state: &mut H) { - self.salg_family.hash(state); - self.salg_type.hash(state); - self.salg_feat.hash(state); - self.salg_mask.hash(state); - self.salg_name.hash(state); - } - } - - impl PartialEq for uinput_setup { - fn eq(&self, other: &uinput_setup) -> bool { - self.id == other.id - && self.name[..] == other.name[..] - && self.ff_effects_max == other.ff_effects_max - } - } - impl Eq for uinput_setup {} - - impl ::fmt::Debug for uinput_setup { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("uinput_setup") - .field("id", &self.id) - .field("name", &&self.name[..]) - .field("ff_effects_max", &self.ff_effects_max) - .finish() - } - } - - impl ::hash::Hash for uinput_setup { - fn hash(&self, state: &mut H) { - self.id.hash(state); - self.name.hash(state); - self.ff_effects_max.hash(state); - } - } - - impl PartialEq for uinput_user_dev { - fn eq(&self, other: &uinput_user_dev) -> bool { - self.name[..] == other.name[..] - && self.id == other.id - && self.ff_effects_max == other.ff_effects_max - && self.absmax[..] == other.absmax[..] - && self.absmin[..] == other.absmin[..] - && self.absfuzz[..] == other.absfuzz[..] - && self.absflat[..] == other.absflat[..] - } - } - impl Eq for uinput_user_dev {} - - impl ::fmt::Debug for uinput_user_dev { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("uinput_setup") - .field("name", &&self.name[..]) - .field("id", &self.id) - .field("ff_effects_max", &self.ff_effects_max) - .field("absmax", &&self.absmax[..]) - .field("absmin", &&self.absmin[..]) - .field("absfuzz", &&self.absfuzz[..]) - .field("absflat", &&self.absflat[..]) - .finish() - } - } - - impl ::hash::Hash for uinput_user_dev { - fn hash(&self, state: &mut H) { - self.name.hash(state); - self.id.hash(state); - self.ff_effects_max.hash(state); - self.absmax.hash(state); - self.absmin.hash(state); - self.absfuzz.hash(state); - self.absflat.hash(state); - } - } - - impl ::fmt::Debug for __c_anonymous_ifr_ifru { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ifr_ifru") - .field("ifru_addr", unsafe { &self.ifru_addr }) - .field("ifru_dstaddr", unsafe { &self.ifru_dstaddr }) - .field("ifru_broadaddr", unsafe { &self.ifru_broadaddr }) - .field("ifru_netmask", unsafe { &self.ifru_netmask }) - .field("ifru_hwaddr", unsafe { &self.ifru_hwaddr }) - .field("ifru_flags", unsafe { &self.ifru_flags }) - .field("ifru_ifindex", unsafe { &self.ifru_ifindex }) - .field("ifru_metric", unsafe { &self.ifru_metric }) - .field("ifru_mtu", unsafe { &self.ifru_mtu }) - .field("ifru_map", unsafe { &self.ifru_map }) - .field("ifru_slave", unsafe { &self.ifru_slave }) - .field("ifru_newname", unsafe { &self.ifru_newname }) - .field("ifru_data", unsafe { &self.ifru_data }) - .finish() - } - } - impl ::fmt::Debug for ifreq { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ifreq") - .field("ifr_name", &self.ifr_name) - .field("ifr_ifru", &self.ifr_ifru) - .finish() - } - } - - impl ::fmt::Debug for __c_anonymous_ifc_ifcu { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ifr_ifru") - .field("ifcu_buf", unsafe { &self.ifcu_buf }) - .field("ifcu_req", unsafe { &self.ifcu_req }) - .finish() - } - } - impl ::fmt::Debug for ifconf { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ifconf") - .field("ifc_len", &self.ifc_len) - .field("ifc_ifcu", &self.ifc_ifcu) - .finish() - } - } - - impl PartialEq for prop_info { - fn eq(&self, other: &prop_info) -> bool { - self.__name == other.__name && - self.__serial == other.__serial && - self.__value == other.__value - } - } - impl Eq for prop_info {} - impl ::fmt::Debug for prop_info { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("prop_info") - .field("__name", &self.__name) - .field("__serial", &self.__serial) - .field("__value", &self.__value) - .finish() - } - } - } } pub const MADV_SOFT_OFFLINE: ::c_int = 101; diff --git a/src/unix/linux_like/emscripten/align.rs b/src/unix/linux_like/emscripten/align.rs index b9ea3f39efdf5..cd0470ec30ceb 100644 --- a/src/unix/linux_like/emscripten/align.rs +++ b/src/unix/linux_like/emscripten/align.rs @@ -1,7 +1,6 @@ macro_rules! expand_align { () => { s! { - #[allow(missing_debug_implementations)] #[repr(align(4))] pub struct pthread_mutex_t { size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T], @@ -26,9 +25,7 @@ macro_rules! expand_align { pub struct pthread_condattr_t { size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T], } - } - s_no_extra_traits! { #[cfg_attr(target_pointer_width = "32", repr(align(4)))] #[cfg_attr(target_pointer_width = "64", @@ -37,38 +34,10 @@ macro_rules! expand_align { size: [u8; ::__SIZEOF_PTHREAD_COND_T], } - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct max_align_t { priv_: [f64; 4] } - - } - - cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for pthread_cond_t { - fn eq(&self, other: &pthread_cond_t) -> bool { - self.size - .iter() - .zip(other.size.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for pthread_cond_t {} - impl ::fmt::Debug for pthread_cond_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("pthread_cond_t") - // FIXME: .field("size", &self.size) - .finish() - } - } - impl ::hash::Hash for pthread_cond_t { - fn hash(&self, state: &mut H) { - self.size.hash(state); - } - } - } } }; } diff --git a/src/unix/linux_like/emscripten/mod.rs b/src/unix/linux_like/emscripten/mod.rs index 8014060890963..4c2567c7a8ca5 100644 --- a/src/unix/linux_like/emscripten/mod.rs +++ b/src/unix/linux_like/emscripten/mod.rs @@ -42,7 +42,6 @@ pub type statfs64 = ::statfs; pub type statvfs64 = ::statvfs; pub type dirent64 = ::dirent; -#[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum fpos64_t {} // FIXME: fill this out with a struct impl ::Copy for fpos64_t {} impl ::Clone for fpos64_t { @@ -348,9 +347,7 @@ s! { pub updated: ::c_ulong, pub ha: [::c_uchar; ::MAX_ADDR_LEN], } -} -s_no_extra_traits! { pub struct dirent { pub d_ino: ::ino_t, pub d_off: ::off_t, @@ -385,135 +382,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for dirent { - fn eq(&self, other: &dirent) -> bool { - self.d_ino == other.d_ino - && self.d_off == other.d_off - && self.d_reclen == other.d_reclen - && self.d_type == other.d_type - && self - .d_name - .iter() - .zip(other.d_name.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for dirent {} - impl ::fmt::Debug for dirent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("dirent") - .field("d_ino", &self.d_ino) - .field("d_off", &self.d_off) - .field("d_reclen", &self.d_reclen) - .field("d_type", &self.d_type) - // FIXME: .field("d_name", &self.d_name) - .finish() - } - } - impl ::hash::Hash for dirent { - fn hash(&self, state: &mut H) { - self.d_ino.hash(state); - self.d_off.hash(state); - self.d_reclen.hash(state); - self.d_type.hash(state); - self.d_name.hash(state); - } - } - - impl PartialEq for sysinfo { - fn eq(&self, other: &sysinfo) -> bool { - self.uptime == other.uptime - && self.loads == other.loads - && self.totalram == other.totalram - && self.freeram == other.freeram - && self.sharedram == other.sharedram - && self.bufferram == other.bufferram - && self.totalswap == other.totalswap - && self.freeswap == other.freeswap - && self.procs == other.procs - && self.pad == other.pad - && self.totalhigh == other.totalhigh - && self.freehigh == other.freehigh - && self.mem_unit == other.mem_unit - && self - .__reserved - .iter() - .zip(other.__reserved.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for sysinfo {} - impl ::fmt::Debug for sysinfo { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sysinfo") - .field("uptime", &self.uptime) - .field("loads", &self.loads) - .field("totalram", &self.totalram) - .field("freeram", &self.freeram) - .field("sharedram", &self.sharedram) - .field("bufferram", &self.bufferram) - .field("totalswap", &self.totalswap) - .field("freeswap", &self.freeswap) - .field("procs", &self.procs) - .field("pad", &self.pad) - .field("totalhigh", &self.totalhigh) - .field("freehigh", &self.freehigh) - .field("mem_unit", &self.mem_unit) - // FIXME: .field("__reserved", &self.__reserved) - .finish() - } - } - impl ::hash::Hash for sysinfo { - fn hash(&self, state: &mut H) { - self.uptime.hash(state); - self.loads.hash(state); - self.totalram.hash(state); - self.freeram.hash(state); - self.sharedram.hash(state); - self.bufferram.hash(state); - self.totalswap.hash(state); - self.freeswap.hash(state); - self.procs.hash(state); - self.pad.hash(state); - self.totalhigh.hash(state); - self.freehigh.hash(state); - self.mem_unit.hash(state); - self.__reserved.hash(state); - } - } - - impl PartialEq for mq_attr { - fn eq(&self, other: &mq_attr) -> bool { - self.mq_flags == other.mq_flags && - self.mq_maxmsg == other.mq_maxmsg && - self.mq_msgsize == other.mq_msgsize && - self.mq_curmsgs == other.mq_curmsgs - } - } - impl Eq for mq_attr {} - impl ::fmt::Debug for mq_attr { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("mq_attr") - .field("mq_flags", &self.mq_flags) - .field("mq_maxmsg", &self.mq_maxmsg) - .field("mq_msgsize", &self.mq_msgsize) - .field("mq_curmsgs", &self.mq_curmsgs) - .finish() - } - } - impl ::hash::Hash for mq_attr { - fn hash(&self, state: &mut H) { - self.mq_flags.hash(state); - self.mq_maxmsg.hash(state); - self.mq_msgsize.hash(state); - self.mq_curmsgs.hash(state); - } - } - } -} - pub const MADV_SOFT_OFFLINE: ::c_int = 101; pub const MS_NOUSER: ::c_ulong = 0x80000000; pub const MS_RMT_MASK: ::c_ulong = 0x02800051; diff --git a/src/unix/linux_like/linux/align.rs b/src/unix/linux_like/linux/align.rs index 1036e23dc8f09..839e490c5cb4c 100644 --- a/src/unix/linux_like/linux/align.rs +++ b/src/unix/linux_like/linux/align.rs @@ -63,9 +63,7 @@ macro_rules! expand_align { pub fd: ::c_int, pub pid: ::c_int, } - } - s_no_extra_traits! { #[cfg_attr(all(any(target_env = "musl", target_env = "ohos"), target_pointer_width = "32"), repr(align(4)))] @@ -169,7 +167,6 @@ macro_rules! expand_align { // linux/can.h #[repr(align(8))] - #[allow(missing_debug_implementations)] pub struct can_frame { pub can_id: canid_t, pub can_dlc: u8, @@ -180,7 +177,6 @@ macro_rules! expand_align { } #[repr(align(8))] - #[allow(missing_debug_implementations)] pub struct canfd_frame { pub can_id: canid_t, pub len: u8, @@ -191,7 +187,6 @@ macro_rules! expand_align { } #[repr(align(8))] - #[allow(missing_debug_implementations)] pub struct canxl_frame { pub prio: canid_t, pub flags: u8, diff --git a/src/unix/linux_like/linux/gnu/b32/arm/align.rs b/src/unix/linux_like/linux/gnu/b32/arm/align.rs index 2645ec4c3d4f1..714f1e47cde09 100644 --- a/src/unix/linux_like/linux/gnu/b32/arm/align.rs +++ b/src/unix/linux_like/linux/gnu/b32/arm/align.rs @@ -1,11 +1,9 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] +s! { #[repr(align(8))] pub struct max_align_t { priv_: [i64; 2] } - #[allow(missing_debug_implementations)] #[repr(align(8))] pub struct ucontext_t { pub uc_flags: ::c_ulong, @@ -16,38 +14,3 @@ s_no_extra_traits! { pub uc_regspace: [::c_ulong; 128], } } - -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for ucontext_t { - fn eq(&self, other: &ucontext_t) -> bool { - self.uc_flags == other.uc_flags - && self.uc_link == other.uc_link - && self.uc_stack == other.uc_stack - && self.uc_mcontext == other.uc_mcontext - && self.uc_sigmask == other.uc_sigmask - } - } - impl Eq for ucontext_t {} - impl ::fmt::Debug for ucontext_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ucontext_t") - .field("uc_flags", &self.uc_link) - .field("uc_link", &self.uc_link) - .field("uc_stack", &self.uc_stack) - .field("uc_mcontext", &self.uc_mcontext) - .field("uc_sigmask", &self.uc_sigmask) - .finish() - } - } - impl ::hash::Hash for ucontext_t { - fn hash(&self, state: &mut H) { - self.uc_flags.hash(state); - self.uc_link.hash(state); - self.uc_stack.hash(state); - self.uc_mcontext.hash(state); - self.uc_sigmask.hash(state); - } - } - } -} diff --git a/src/unix/linux_like/linux/gnu/b32/csky/align.rs b/src/unix/linux_like/linux/gnu/b32/csky/align.rs index 825546be90a91..52fffb7bc71e5 100644 --- a/src/unix/linux_like/linux/gnu/b32/csky/align.rs +++ b/src/unix/linux_like/linux/gnu/b32/csky/align.rs @@ -1,5 +1,4 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] +s! { #[repr(align(8))] pub struct max_align_t { priv_: [i64; 2] diff --git a/src/unix/linux_like/linux/gnu/b32/m68k/align.rs b/src/unix/linux_like/linux/gnu/b32/m68k/align.rs index 639394a309e3a..44687a016b7cc 100644 --- a/src/unix/linux_like/linux/gnu/b32/m68k/align.rs +++ b/src/unix/linux_like/linux/gnu/b32/m68k/align.rs @@ -1,5 +1,4 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] +s! { #[repr(align(2))] pub struct max_align_t { priv_: [i8; 20] diff --git a/src/unix/linux_like/linux/gnu/b32/mips/align.rs b/src/unix/linux_like/linux/gnu/b32/mips/align.rs index 8c228ebab72ce..7bf5665c2f0cc 100644 --- a/src/unix/linux_like/linux/gnu/b32/mips/align.rs +++ b/src/unix/linux_like/linux/gnu/b32/mips/align.rs @@ -1,5 +1,4 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] +s! { #[repr(align(8))] pub struct max_align_t { priv_: [f32; 4] diff --git a/src/unix/linux_like/linux/gnu/b32/riscv32/align.rs b/src/unix/linux_like/linux/gnu/b32/riscv32/align.rs index 48d152a5721ec..6d0eded3c84fd 100644 --- a/src/unix/linux_like/linux/gnu/b32/riscv32/align.rs +++ b/src/unix/linux_like/linux/gnu/b32/riscv32/align.rs @@ -1,5 +1,4 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] +s! { pub struct ucontext_t { pub __uc_flags: ::c_ulong, pub uc_link: *mut ucontext_t, @@ -8,33 +7,28 @@ s_no_extra_traits! { pub uc_mcontext: mcontext_t, } - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct mcontext_t { pub __gregs: [::c_ulong; 32], pub __fpregs: __riscv_mc_fp_state, } - #[allow(missing_debug_implementations)] pub union __riscv_mc_fp_state { pub __f: __riscv_mc_f_ext_state, pub __d: __riscv_mc_d_ext_state, pub __q: __riscv_mc_q_ext_state, } - #[allow(missing_debug_implementations)] pub struct __riscv_mc_f_ext_state { pub __f: [::c_uint; 32], pub __fcsr: ::c_uint, } - #[allow(missing_debug_implementations)] pub struct __riscv_mc_d_ext_state { pub __f: [::c_ulonglong; 32], pub __fcsr: ::c_uint, } - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct __riscv_mc_q_ext_state { pub __f: [::c_ulonglong; 64], diff --git a/src/unix/linux_like/linux/gnu/b32/sparc/align.rs b/src/unix/linux_like/linux/gnu/b32/sparc/align.rs index 98fda883cd374..c8557c2f65533 100644 --- a/src/unix/linux_like/linux/gnu/b32/sparc/align.rs +++ b/src/unix/linux_like/linux/gnu/b32/sparc/align.rs @@ -1,5 +1,4 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] +s! { #[repr(align(8))] pub struct max_align_t { priv_: [i64; 3] diff --git a/src/unix/linux_like/linux/gnu/b32/x86/align.rs b/src/unix/linux_like/linux/gnu/b32/x86/align.rs index 96634749f53b2..a1afce4c96bc9 100644 --- a/src/unix/linux_like/linux/gnu/b32/x86/align.rs +++ b/src/unix/linux_like/linux/gnu/b32/x86/align.rs @@ -1,5 +1,4 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] +s! { #[repr(align(16))] pub struct max_align_t { priv_: [f64; 6] diff --git a/src/unix/linux_like/linux/gnu/b32/x86/mod.rs b/src/unix/linux_like/linux/gnu/b32/x86/mod.rs index 8e206b114cd3a..94d928861ee7f 100644 --- a/src/unix/linux_like/linux/gnu/b32/x86/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/x86/mod.rs @@ -237,9 +237,6 @@ s! { pub ss_size: ::size_t } -} - -s_no_extra_traits! { pub struct user_fpxregs_struct { pub cwd: ::c_ushort, pub swd: ::c_ushort, @@ -267,105 +264,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for user_fpxregs_struct { - fn eq(&self, other: &user_fpxregs_struct) -> bool { - self.cwd == other.cwd - && self.swd == other.swd - && self.twd == other.twd - && self.fop == other.fop - && self.fip == other.fip - && self.fcs == other.fcs - && self.foo == other.foo - && self.fos == other.fos - && self.mxcsr == other.mxcsr - // Ignore __reserved field - && self.st_space == other.st_space - && self.xmm_space == other.xmm_space - // Ignore padding field - } - } - - impl Eq for user_fpxregs_struct {} - - impl ::fmt::Debug for user_fpxregs_struct { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("user_fpxregs_struct") - .field("cwd", &self.cwd) - .field("swd", &self.swd) - .field("twd", &self.twd) - .field("fop", &self.fop) - .field("fip", &self.fip) - .field("fcs", &self.fcs) - .field("foo", &self.foo) - .field("fos", &self.fos) - .field("mxcsr", &self.mxcsr) - // Ignore __reserved field - .field("st_space", &self.st_space) - .field("xmm_space", &self.xmm_space) - // Ignore padding field - .finish() - } - } - - impl ::hash::Hash for user_fpxregs_struct { - fn hash(&self, state: &mut H) { - self.cwd.hash(state); - self.swd.hash(state); - self.twd.hash(state); - self.fop.hash(state); - self.fip.hash(state); - self.fcs.hash(state); - self.foo.hash(state); - self.fos.hash(state); - self.mxcsr.hash(state); - // Ignore __reserved field - self.st_space.hash(state); - self.xmm_space.hash(state); - // Ignore padding field - } - } - - impl PartialEq for ucontext_t { - fn eq(&self, other: &ucontext_t) -> bool { - self.uc_flags == other.uc_flags - && self.uc_link == other.uc_link - && self.uc_stack == other.uc_stack - && self.uc_mcontext == other.uc_mcontext - && self.uc_sigmask == other.uc_sigmask - // Ignore __private field - } - } - - impl Eq for ucontext_t {} - - impl ::fmt::Debug for ucontext_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ucontext_t") - .field("uc_flags", &self.uc_flags) - .field("uc_link", &self.uc_link) - .field("uc_stack", &self.uc_stack) - .field("uc_mcontext", &self.uc_mcontext) - .field("uc_sigmask", &self.uc_sigmask) - // Ignore __private field - .finish() - } - } - - impl ::hash::Hash for ucontext_t { - fn hash(&self, state: &mut H) { - self.uc_flags.hash(state); - self.uc_link.hash(state); - self.uc_stack.hash(state); - self.uc_mcontext.hash(state); - self.uc_sigmask.hash(state); - // Ignore __private field - } - } - } -} - pub const VEOF: usize = 4; pub const RTLD_DEEPBIND: ::c_int = 0x8; pub const RTLD_GLOBAL: ::c_int = 0x100; diff --git a/src/unix/linux_like/linux/gnu/b64/aarch64/align.rs b/src/unix/linux_like/linux/gnu/b64/aarch64/align.rs index a035773c716fe..fb41bb84de6ae 100644 --- a/src/unix/linux_like/linux/gnu/b64/aarch64/align.rs +++ b/src/unix/linux_like/linux/gnu/b64/aarch64/align.rs @@ -1,12 +1,9 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] +s! { #[repr(align(16))] pub struct max_align_t { priv_: [f32; 8] } -} -s! { pub struct ucontext_t { pub uc_flags: ::c_ulong, pub uc_link: *mut ucontext_t, diff --git a/src/unix/linux_like/linux/gnu/b64/loongarch64/align.rs b/src/unix/linux_like/linux/gnu/b64/loongarch64/align.rs index dc191f51fdb1c..6df12fb97aad9 100644 --- a/src/unix/linux_like/linux/gnu/b64/loongarch64/align.rs +++ b/src/unix/linux_like/linux/gnu/b64/loongarch64/align.rs @@ -1,12 +1,9 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] +s! { #[repr(align(16))] pub struct max_align_t { priv_: [f64; 4] } -} -s! { pub struct ucontext_t { pub uc_flags: ::c_ulong, pub uc_link: *mut ucontext_t, diff --git a/src/unix/linux_like/linux/gnu/b64/mips64/align.rs b/src/unix/linux_like/linux/gnu/b64/mips64/align.rs index 7ca870fd02b71..340ad79821862 100644 --- a/src/unix/linux_like/linux/gnu/b64/mips64/align.rs +++ b/src/unix/linux_like/linux/gnu/b64/mips64/align.rs @@ -1,5 +1,4 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] +s! { #[repr(align(16))] pub struct max_align_t { priv_: [f64; 4] diff --git a/src/unix/linux_like/linux/gnu/b64/powerpc64/align.rs b/src/unix/linux_like/linux/gnu/b64/powerpc64/align.rs index 29d1e1c7b8a55..67e0f07817638 100644 --- a/src/unix/linux_like/linux/gnu/b64/powerpc64/align.rs +++ b/src/unix/linux_like/linux/gnu/b64/powerpc64/align.rs @@ -1,5 +1,4 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] +s! { #[repr(align(16))] pub struct max_align_t { priv_: [i64; 4] diff --git a/src/unix/linux_like/linux/gnu/b64/riscv64/align.rs b/src/unix/linux_like/linux/gnu/b64/riscv64/align.rs index 48d152a5721ec..6d0eded3c84fd 100644 --- a/src/unix/linux_like/linux/gnu/b64/riscv64/align.rs +++ b/src/unix/linux_like/linux/gnu/b64/riscv64/align.rs @@ -1,5 +1,4 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] +s! { pub struct ucontext_t { pub __uc_flags: ::c_ulong, pub uc_link: *mut ucontext_t, @@ -8,33 +7,28 @@ s_no_extra_traits! { pub uc_mcontext: mcontext_t, } - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct mcontext_t { pub __gregs: [::c_ulong; 32], pub __fpregs: __riscv_mc_fp_state, } - #[allow(missing_debug_implementations)] pub union __riscv_mc_fp_state { pub __f: __riscv_mc_f_ext_state, pub __d: __riscv_mc_d_ext_state, pub __q: __riscv_mc_q_ext_state, } - #[allow(missing_debug_implementations)] pub struct __riscv_mc_f_ext_state { pub __f: [::c_uint; 32], pub __fcsr: ::c_uint, } - #[allow(missing_debug_implementations)] pub struct __riscv_mc_d_ext_state { pub __f: [::c_ulonglong; 32], pub __fcsr: ::c_uint, } - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct __riscv_mc_q_ext_state { pub __f: [::c_ulonglong; 64], diff --git a/src/unix/linux_like/linux/gnu/b64/s390x.rs b/src/unix/linux_like/linux/gnu/b64/s390x.rs index deeb23f9ed8e9..283e26a7a1be6 100644 --- a/src/unix/linux_like/linux/gnu/b64/s390x.rs +++ b/src/unix/linux_like/linux/gnu/b64/s390x.rs @@ -209,9 +209,7 @@ s! { pub f_namemax: ::c_ulong, __f_spare: [::c_int; 6], } -} -s_no_extra_traits! { // FIXME: This is actually a union. pub struct fpreg_t { pub d: ::c_double, @@ -219,33 +217,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for fpreg_t { - fn eq(&self, other: &fpreg_t) -> bool { - self.d == other.d - } - } - - impl Eq for fpreg_t {} - - impl ::fmt::Debug for fpreg_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("fpreg_t") - .field("d", &self.d) - .finish() - } - } - - impl ::hash::Hash for fpreg_t { - fn hash(&self, state: &mut H) { - let d: u64 = unsafe { ::mem::transmute(self.d) }; - d.hash(state); - } - } - } -} - pub const POSIX_FADV_DONTNEED: ::c_int = 6; pub const POSIX_FADV_NOREUSE: ::c_int = 7; diff --git a/src/unix/linux_like/linux/gnu/b64/sparc64/align.rs b/src/unix/linux_like/linux/gnu/b64/sparc64/align.rs index 29d1e1c7b8a55..67e0f07817638 100644 --- a/src/unix/linux_like/linux/gnu/b64/sparc64/align.rs +++ b/src/unix/linux_like/linux/gnu/b64/sparc64/align.rs @@ -1,5 +1,4 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] +s! { #[repr(align(16))] pub struct max_align_t { priv_: [i64; 4] diff --git a/src/unix/linux_like/linux/gnu/b64/x86_64/align.rs b/src/unix/linux_like/linux/gnu/b64/x86_64/align.rs index ba3075edd7e36..8d7623ab45c35 100644 --- a/src/unix/linux_like/linux/gnu/b64/x86_64/align.rs +++ b/src/unix/linux_like/linux/gnu/b64/x86_64/align.rs @@ -1,12 +1,9 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] +s! { #[repr(align(16))] pub struct max_align_t { priv_: [f64; 4] } -} -s! { #[repr(align(8))] pub struct clone_args { pub flags: ::c_ulonglong, diff --git a/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs b/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs index 86536f185750f..d6feb2983327f 100644 --- a/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs @@ -267,9 +267,7 @@ s! { pub flags: ::__u32, pub pad: ::__u32, } -} -s_no_extra_traits! { pub struct user_fpregs_struct { pub cwd: ::c_ushort, pub swd: ::c_ushort, @@ -299,101 +297,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for user_fpregs_struct { - fn eq(&self, other: &user_fpregs_struct) -> bool { - self.cwd == other.cwd - && self.swd == other.swd - && self.ftw == other.ftw - && self.fop == other.fop - && self.rip == other.rip - && self.rdp == other.rdp - && self.mxcsr == other.mxcsr - && self.mxcr_mask == other.mxcr_mask - && self.st_space == other.st_space - && self - .xmm_space - .iter() - .zip(other.xmm_space.iter()) - .all(|(a,b)| a == b) - // Ignore padding field - } - } - - impl Eq for user_fpregs_struct {} - - impl ::fmt::Debug for user_fpregs_struct { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("user_fpregs_struct") - .field("cwd", &self.cwd) - .field("ftw", &self.ftw) - .field("fop", &self.fop) - .field("rip", &self.rip) - .field("rdp", &self.rdp) - .field("mxcsr", &self.mxcsr) - .field("mxcr_mask", &self.mxcr_mask) - .field("st_space", &self.st_space) - // FIXME: .field("xmm_space", &self.xmm_space) - // Ignore padding field - .finish() - } - } - - impl ::hash::Hash for user_fpregs_struct { - fn hash(&self, state: &mut H) { - self.cwd.hash(state); - self.ftw.hash(state); - self.fop.hash(state); - self.rip.hash(state); - self.rdp.hash(state); - self.mxcsr.hash(state); - self.mxcr_mask.hash(state); - self.st_space.hash(state); - self.xmm_space.hash(state); - // Ignore padding field - } - } - - impl PartialEq for ucontext_t { - fn eq(&self, other: &ucontext_t) -> bool { - self.uc_flags == other.uc_flags - && self.uc_link == other.uc_link - && self.uc_stack == other.uc_stack - && self.uc_mcontext == other.uc_mcontext - && self.uc_sigmask == other.uc_sigmask - // Ignore __private field - } - } - - impl Eq for ucontext_t {} - - impl ::fmt::Debug for ucontext_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ucontext_t") - .field("uc_flags", &self.uc_flags) - .field("uc_link", &self.uc_link) - .field("uc_stack", &self.uc_stack) - .field("uc_mcontext", &self.uc_mcontext) - .field("uc_sigmask", &self.uc_sigmask) - // Ignore __private field - .finish() - } - } - - impl ::hash::Hash for ucontext_t { - fn hash(&self, state: &mut H) { - self.uc_flags.hash(state); - self.uc_link.hash(state); - self.uc_stack.hash(state); - self.uc_mcontext.hash(state); - self.uc_sigmask.hash(state); - // Ignore __private field - } - } - } -} - pub const POSIX_FADV_DONTNEED: ::c_int = 4; pub const POSIX_FADV_NOREUSE: ::c_int = 5; diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs index 4d235ba0ad951..3fcfceb3a3aca 100644 --- a/src/unix/linux_like/linux/gnu/mod.rs +++ b/src/unix/linux_like/linux/gnu/mod.rs @@ -453,6 +453,46 @@ s! { pub aio_flags: ::__u32, pub aio_resfd: ::__u32, } + + pub struct utmpx { + pub ut_type: ::c_short, + pub ut_pid: ::pid_t, + pub ut_line: [::c_char; __UT_LINESIZE], + pub ut_id: [::c_char; 4], + + pub ut_user: [::c_char; __UT_NAMESIZE], + pub ut_host: [::c_char; __UT_HOSTSIZE], + pub ut_exit: __exit_status, + + #[cfg(any(target_arch = "aarch64", + target_arch = "s390x", + target_arch = "loongarch64", + all(target_pointer_width = "32", + not(target_arch = "x86_64"))))] + pub ut_session: ::c_long, + #[cfg(any(target_arch = "aarch64", + target_arch = "s390x", + target_arch = "loongarch64", + all(target_pointer_width = "32", + not(target_arch = "x86_64"))))] + pub ut_tv: ::timeval, + + #[cfg(not(any(target_arch = "aarch64", + target_arch = "s390x", + target_arch = "loongarch64", + all(target_pointer_width = "32", + not(target_arch = "x86_64")))))] + pub ut_session: i32, + #[cfg(not(any(target_arch = "aarch64", + target_arch = "s390x", + target_arch = "loongarch64", + all(target_pointer_width = "32", + not(target_arch = "x86_64")))))] + pub ut_tv: __timeval, + + pub ut_addr_v6: [i32; 4], + __glibc_reserved: [::c_char; 20], + } } impl siginfo_t { @@ -551,142 +591,6 @@ impl ::Clone for __c_anonymous_ptrace_syscall_info_data { } } -s_no_extra_traits! { - pub struct utmpx { - pub ut_type: ::c_short, - pub ut_pid: ::pid_t, - pub ut_line: [::c_char; __UT_LINESIZE], - pub ut_id: [::c_char; 4], - - pub ut_user: [::c_char; __UT_NAMESIZE], - pub ut_host: [::c_char; __UT_HOSTSIZE], - pub ut_exit: __exit_status, - - #[cfg(any(target_arch = "aarch64", - target_arch = "s390x", - target_arch = "loongarch64", - all(target_pointer_width = "32", - not(target_arch = "x86_64"))))] - pub ut_session: ::c_long, - #[cfg(any(target_arch = "aarch64", - target_arch = "s390x", - target_arch = "loongarch64", - all(target_pointer_width = "32", - not(target_arch = "x86_64"))))] - pub ut_tv: ::timeval, - - #[cfg(not(any(target_arch = "aarch64", - target_arch = "s390x", - target_arch = "loongarch64", - all(target_pointer_width = "32", - not(target_arch = "x86_64")))))] - pub ut_session: i32, - #[cfg(not(any(target_arch = "aarch64", - target_arch = "s390x", - target_arch = "loongarch64", - all(target_pointer_width = "32", - not(target_arch = "x86_64")))))] - pub ut_tv: __timeval, - - pub ut_addr_v6: [i32; 4], - __glibc_reserved: [::c_char; 20], - } -} - -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for utmpx { - fn eq(&self, other: &utmpx) -> bool { - self.ut_type == other.ut_type - && self.ut_pid == other.ut_pid - && self.ut_line == other.ut_line - && self.ut_id == other.ut_id - && self.ut_user == other.ut_user - && self - .ut_host - .iter() - .zip(other.ut_host.iter()) - .all(|(a,b)| a == b) - && self.ut_exit == other.ut_exit - && self.ut_session == other.ut_session - && self.ut_tv == other.ut_tv - && self.ut_addr_v6 == other.ut_addr_v6 - && self.__glibc_reserved == other.__glibc_reserved - } - } - - impl Eq for utmpx {} - - impl ::fmt::Debug for utmpx { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("utmpx") - .field("ut_type", &self.ut_type) - .field("ut_pid", &self.ut_pid) - .field("ut_line", &self.ut_line) - .field("ut_id", &self.ut_id) - .field("ut_user", &self.ut_user) - // FIXME: .field("ut_host", &self.ut_host) - .field("ut_exit", &self.ut_exit) - .field("ut_session", &self.ut_session) - .field("ut_tv", &self.ut_tv) - .field("ut_addr_v6", &self.ut_addr_v6) - .field("__glibc_reserved", &self.__glibc_reserved) - .finish() - } - } - - impl ::hash::Hash for utmpx { - fn hash(&self, state: &mut H) { - self.ut_type.hash(state); - self.ut_pid.hash(state); - self.ut_line.hash(state); - self.ut_id.hash(state); - self.ut_user.hash(state); - self.ut_host.hash(state); - self.ut_exit.hash(state); - self.ut_session.hash(state); - self.ut_tv.hash(state); - self.ut_addr_v6.hash(state); - self.__glibc_reserved.hash(state); - } - } - - impl PartialEq for __c_anonymous_ptrace_syscall_info_data { - fn eq(&self, other: &__c_anonymous_ptrace_syscall_info_data) -> bool { - unsafe { - self.entry == other.entry || - self.exit == other.exit || - self.seccomp == other.seccomp - } - } - } - - impl Eq for __c_anonymous_ptrace_syscall_info_data {} - - impl ::fmt::Debug for __c_anonymous_ptrace_syscall_info_data { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - unsafe { - f.debug_struct("__c_anonymous_ptrace_syscall_info_data") - .field("entry", &self.entry) - .field("exit", &self.exit) - .field("seccomp", &self.seccomp) - .finish() - } - } - } - - impl ::hash::Hash for __c_anonymous_ptrace_syscall_info_data { - fn hash(&self, state: &mut H) { - unsafe { - self.entry.hash(state); - self.exit.hash(state); - self.seccomp.hash(state); - } - } - } - } -} - // include/uapi/asm-generic/hugetlb_encode.h pub const HUGETLB_FLAG_ENCODE_SHIFT: ::c_int = 26; pub const HUGETLB_FLAG_ENCODE_MASK: ::c_int = 0x3f; diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index ac0bb87b2ced4..74eb36b4e6ccf 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -69,7 +69,6 @@ pub type sctp_assoc_t = ::__s32; pub type eventfd_t = u64; missing! { - #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum fpos64_t {} // FIXME: fill this out with a struct } @@ -1053,7 +1052,8 @@ cfg_if! { } } } -s_no_extra_traits! { + +s! { pub struct sockaddr_nl { pub nl_family: ::sa_family_t, nl_pad: ::c_ushort, @@ -1093,7 +1093,6 @@ s_no_extra_traits! { pub absflat: [::__s32; ABS_CNT], } - #[allow(missing_debug_implementations)] pub struct af_alg_iv { pub ivlen: u32, pub iv: [::c_uchar; 0], @@ -1198,24 +1197,21 @@ s_no_extra_traits! { } } -s_no_extra_traits! { +s! { // linux/net_tstamp.h - #[allow(missing_debug_implementations)] pub struct sock_txtime { pub clockid: ::clockid_t, pub flags: ::__u32, } } -s_no_extra_traits! { +s! { // linux/can.h - #[allow(missing_debug_implementations)] pub union __c_anonymous_sockaddr_can_can_addr { pub tp: __c_anonymous_sockaddr_can_tp, pub j1939: __c_anonymous_sockaddr_can_j1939, } - #[allow(missing_debug_implementations)] pub struct sockaddr_can { pub can_family: ::sa_family_t, pub can_ifindex: ::c_int, @@ -1223,7 +1219,7 @@ s_no_extra_traits! { } } -s_no_extra_traits! { +s! { // linux/wireless.h pub union iwreq_data { pub name: [c_char; ::IFNAMSIZ], @@ -1262,520 +1258,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for sockaddr_nl { - fn eq(&self, other: &sockaddr_nl) -> bool { - self.nl_family == other.nl_family && - self.nl_pid == other.nl_pid && - self.nl_groups == other.nl_groups - } - } - impl Eq for sockaddr_nl {} - impl ::fmt::Debug for sockaddr_nl { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_nl") - .field("nl_family", &self.nl_family) - .field("nl_pid", &self.nl_pid) - .field("nl_groups", &self.nl_groups) - .finish() - } - } - impl ::hash::Hash for sockaddr_nl { - fn hash(&self, state: &mut H) { - self.nl_family.hash(state); - self.nl_pid.hash(state); - self.nl_groups.hash(state); - } - } - - impl PartialEq for dirent { - fn eq(&self, other: &dirent) -> bool { - self.d_ino == other.d_ino - && self.d_off == other.d_off - && self.d_reclen == other.d_reclen - && self.d_type == other.d_type - && self - .d_name - .iter() - .zip(other.d_name.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for dirent {} - - impl ::fmt::Debug for dirent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("dirent") - .field("d_ino", &self.d_ino) - .field("d_off", &self.d_off) - .field("d_reclen", &self.d_reclen) - .field("d_type", &self.d_type) - // FIXME: .field("d_name", &self.d_name) - .finish() - } - } - - impl ::hash::Hash for dirent { - fn hash(&self, state: &mut H) { - self.d_ino.hash(state); - self.d_off.hash(state); - self.d_reclen.hash(state); - self.d_type.hash(state); - self.d_name.hash(state); - } - } - - impl PartialEq for dirent64 { - fn eq(&self, other: &dirent64) -> bool { - self.d_ino == other.d_ino - && self.d_off == other.d_off - && self.d_reclen == other.d_reclen - && self.d_type == other.d_type - && self - .d_name - .iter() - .zip(other.d_name.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for dirent64 {} - - impl ::fmt::Debug for dirent64 { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("dirent64") - .field("d_ino", &self.d_ino) - .field("d_off", &self.d_off) - .field("d_reclen", &self.d_reclen) - .field("d_type", &self.d_type) - // FIXME: .field("d_name", &self.d_name) - .finish() - } - } - - impl ::hash::Hash for dirent64 { - fn hash(&self, state: &mut H) { - self.d_ino.hash(state); - self.d_off.hash(state); - self.d_reclen.hash(state); - self.d_type.hash(state); - self.d_name.hash(state); - } - } - - impl PartialEq for pthread_cond_t { - fn eq(&self, other: &pthread_cond_t) -> bool { - self.size.iter().zip(other.size.iter()).all(|(a,b)| a == b) - } - } - - impl Eq for pthread_cond_t {} - - impl ::fmt::Debug for pthread_cond_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("pthread_cond_t") - // FIXME: .field("size", &self.size) - .finish() - } - } - - impl ::hash::Hash for pthread_cond_t { - fn hash(&self, state: &mut H) { - self.size.hash(state); - } - } - - impl PartialEq for pthread_mutex_t { - fn eq(&self, other: &pthread_mutex_t) -> bool { - self.size.iter().zip(other.size.iter()).all(|(a,b)| a == b) - } - } - - impl Eq for pthread_mutex_t {} - - impl ::fmt::Debug for pthread_mutex_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("pthread_mutex_t") - // FIXME: .field("size", &self.size) - .finish() - } - } - - impl ::hash::Hash for pthread_mutex_t { - fn hash(&self, state: &mut H) { - self.size.hash(state); - } - } - - impl PartialEq for pthread_rwlock_t { - fn eq(&self, other: &pthread_rwlock_t) -> bool { - self.size.iter().zip(other.size.iter()).all(|(a,b)| a == b) - } - } - - impl Eq for pthread_rwlock_t {} - - impl ::fmt::Debug for pthread_rwlock_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("pthread_rwlock_t") - // FIXME: .field("size", &self.size) - .finish() - } - } - - impl ::hash::Hash for pthread_rwlock_t { - fn hash(&self, state: &mut H) { - self.size.hash(state); - } - } - - impl PartialEq for pthread_barrier_t { - fn eq(&self, other: &pthread_barrier_t) -> bool { - self.size.iter().zip(other.size.iter()).all(|(a,b)| a == b) - } - } - - impl Eq for pthread_barrier_t {} - - impl ::fmt::Debug for pthread_barrier_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("pthread_barrier_t") - .field("size", &self.size) - .finish() - } - } - - impl ::hash::Hash for pthread_barrier_t { - fn hash(&self, state: &mut H) { - self.size.hash(state); - } - } - - impl PartialEq for sockaddr_alg { - fn eq(&self, other: &sockaddr_alg) -> bool { - self.salg_family == other.salg_family - && self - .salg_type - .iter() - .zip(other.salg_type.iter()) - .all(|(a, b)| a == b) - && self.salg_feat == other.salg_feat - && self.salg_mask == other.salg_mask - && self - .salg_name - .iter() - .zip(other.salg_name.iter()) - .all(|(a, b)| a == b) - } - } - - impl Eq for sockaddr_alg {} - - impl ::fmt::Debug for sockaddr_alg { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_alg") - .field("salg_family", &self.salg_family) - .field("salg_type", &self.salg_type) - .field("salg_feat", &self.salg_feat) - .field("salg_mask", &self.salg_mask) - .field("salg_name", &&self.salg_name[..]) - .finish() - } - } - - impl ::hash::Hash for sockaddr_alg { - fn hash(&self, state: &mut H) { - self.salg_family.hash(state); - self.salg_type.hash(state); - self.salg_feat.hash(state); - self.salg_mask.hash(state); - self.salg_name.hash(state); - } - } - - impl PartialEq for uinput_setup { - fn eq(&self, other: &uinput_setup) -> bool { - self.id == other.id - && self.name[..] == other.name[..] - && self.ff_effects_max == other.ff_effects_max - } - } - impl Eq for uinput_setup {} - - impl ::fmt::Debug for uinput_setup { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("uinput_setup") - .field("id", &self.id) - .field("name", &&self.name[..]) - .field("ff_effects_max", &self.ff_effects_max) - .finish() - } - } - - impl ::hash::Hash for uinput_setup { - fn hash(&self, state: &mut H) { - self.id.hash(state); - self.name.hash(state); - self.ff_effects_max.hash(state); - } - } - - impl PartialEq for uinput_user_dev { - fn eq(&self, other: &uinput_user_dev) -> bool { - self.name[..] == other.name[..] - && self.id == other.id - && self.ff_effects_max == other.ff_effects_max - && self.absmax[..] == other.absmax[..] - && self.absmin[..] == other.absmin[..] - && self.absfuzz[..] == other.absfuzz[..] - && self.absflat[..] == other.absflat[..] - } - } - impl Eq for uinput_user_dev {} - - impl ::fmt::Debug for uinput_user_dev { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("uinput_setup") - .field("name", &&self.name[..]) - .field("id", &self.id) - .field("ff_effects_max", &self.ff_effects_max) - .field("absmax", &&self.absmax[..]) - .field("absmin", &&self.absmin[..]) - .field("absfuzz", &&self.absfuzz[..]) - .field("absflat", &&self.absflat[..]) - .finish() - } - } - - impl ::hash::Hash for uinput_user_dev { - fn hash(&self, state: &mut H) { - self.name.hash(state); - self.id.hash(state); - self.ff_effects_max.hash(state); - self.absmax.hash(state); - self.absmin.hash(state); - self.absfuzz.hash(state); - self.absflat.hash(state); - } - } - - impl PartialEq for mq_attr { - fn eq(&self, other: &mq_attr) -> bool { - self.mq_flags == other.mq_flags && - self.mq_maxmsg == other.mq_maxmsg && - self.mq_msgsize == other.mq_msgsize && - self.mq_curmsgs == other.mq_curmsgs - } - } - impl Eq for mq_attr {} - impl ::fmt::Debug for mq_attr { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("mq_attr") - .field("mq_flags", &self.mq_flags) - .field("mq_maxmsg", &self.mq_maxmsg) - .field("mq_msgsize", &self.mq_msgsize) - .field("mq_curmsgs", &self.mq_curmsgs) - .finish() - } - } - impl ::hash::Hash for mq_attr { - fn hash(&self, state: &mut H) { - self.mq_flags.hash(state); - self.mq_maxmsg.hash(state); - self.mq_msgsize.hash(state); - self.mq_curmsgs.hash(state); - } - } - impl ::fmt::Debug for __c_anonymous_ifr_ifru { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ifr_ifru") - .field("ifru_addr", unsafe { &self.ifru_addr }) - .field("ifru_dstaddr", unsafe { &self.ifru_dstaddr }) - .field("ifru_broadaddr", unsafe { &self.ifru_broadaddr }) - .field("ifru_netmask", unsafe { &self.ifru_netmask }) - .field("ifru_hwaddr", unsafe { &self.ifru_hwaddr }) - .field("ifru_flags", unsafe { &self.ifru_flags }) - .field("ifru_ifindex", unsafe { &self.ifru_ifindex }) - .field("ifru_metric", unsafe { &self.ifru_metric }) - .field("ifru_mtu", unsafe { &self.ifru_mtu }) - .field("ifru_map", unsafe { &self.ifru_map }) - .field("ifru_slave", unsafe { &self.ifru_slave }) - .field("ifru_newname", unsafe { &self.ifru_newname }) - .field("ifru_data", unsafe { &self.ifru_data }) - .finish() - } - } - impl ::fmt::Debug for ifreq { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ifreq") - .field("ifr_name", &self.ifr_name) - .field("ifr_ifru", &self.ifr_ifru) - .finish() - } - } - - impl ::fmt::Debug for tpacket_req_u { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("tpacket_req_u") - .field("req3", unsafe { &self.req3 }) - .finish() - } - } - - impl ::fmt::Debug for tpacket_bd_header_u { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("tpacket_bd_header_u") - .field("bh1", unsafe { &self.bh1 }) - .finish() - } - } - - impl ::fmt::Debug for tpacket_block_desc { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("tpacket_bd_header_u") - .field("version", &self.version) - .field("offset_to_priv", &self.offset_to_priv) - .field("hdr", &self.hdr) - .finish() - } - } - - impl ::fmt::Debug for __c_anonymous_ifc_ifcu { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ifr_ifru") - .field("ifcu_buf", unsafe { &self.ifcu_buf }) - .field("ifcu_req", unsafe { &self.ifcu_req }) - .finish() - } - } - impl ::fmt::Debug for ifconf { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ifconf") - .field("ifc_len", &self.ifc_len) - .field("ifc_ifcu", &self.ifc_ifcu) - .finish() - } - } - impl ::fmt::Debug for hwtstamp_config { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("hwtstamp_config") - .field("flags", &self.flags) - .field("tx_type", &self.tx_type) - .field("rx_filter", &self.rx_filter) - .finish() - } - } - impl PartialEq for hwtstamp_config { - fn eq(&self, other: &hwtstamp_config) -> bool { - self.flags == other.flags && - self.tx_type == other.tx_type && - self.rx_filter == other.rx_filter - } - } - impl Eq for hwtstamp_config {} - impl ::hash::Hash for hwtstamp_config { - fn hash(&self, state: &mut H) { - self.flags.hash(state); - self.tx_type.hash(state); - self.rx_filter.hash(state); - } - } - - impl ::fmt::Debug for sched_attr { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sched_attr") - .field("size", &self.size) - .field("sched_policy", &self.sched_policy) - .field("sched_flags", &self.sched_flags) - .field("sched_nice", &self.sched_nice) - .field("sched_priority", &self.sched_priority) - .field("sched_runtime", &self.sched_runtime) - .field("sched_deadline", &self.sched_deadline) - .field("sched_period", &self.sched_period) - .finish() - } - } - impl PartialEq for sched_attr { - fn eq(&self, other: &sched_attr) -> bool { - self.size == other.size && - self.sched_policy == other.sched_policy && - self.sched_flags == other.sched_flags && - self.sched_nice == other.sched_nice && - self.sched_priority == other.sched_priority && - self.sched_runtime == other.sched_runtime && - self.sched_deadline == other.sched_deadline && - self.sched_period == other.sched_period - } - } - impl Eq for sched_attr {} - impl ::hash::Hash for sched_attr { - fn hash(&self, state: &mut H) { - self.size.hash(state); - self.sched_policy.hash(state); - self.sched_flags.hash(state); - self.sched_nice.hash(state); - self.sched_priority.hash(state); - self.sched_runtime.hash(state); - self.sched_deadline.hash(state); - self.sched_period.hash(state); - } - } - impl ::fmt::Debug for iwreq_data { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("iwreq_data") - .field("name", unsafe { &self.name }) - .field("essid", unsafe { &self.essid }) - .field("nwid", unsafe { &self.nwid }) - .field("freq", unsafe { &self.freq }) - .field("sens", unsafe { &self.sens }) - .field("bitrate", unsafe { &self.bitrate }) - .field("txpower", unsafe { &self.txpower }) - .field("rts", unsafe { &self.rts }) - .field("frag", unsafe { &self.frag }) - .field("mode", unsafe { &self.mode }) - .field("retry", unsafe { &self.retry }) - .field("encoding", unsafe { &self.encoding }) - .field("power", unsafe { &self.power }) - .field("qual", unsafe { &self.qual }) - .field("ap_addr", unsafe { &self.ap_addr }) - .field("addr", unsafe { &self.addr }) - .field("param", unsafe { &self.param }) - .field("data", unsafe { &self.data }) - .finish() - } - } - - impl ::fmt::Debug for iw_event { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("iw_event") - .field("len", &self.len ) - .field("cmd", &self.cmd ) - .field("u", &self.u ) - .finish() - } - } - - impl ::fmt::Debug for __c_anonymous_iwreq { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("__c_anonymous_iwreq") - .field("ifrn_name", unsafe { &self.ifrn_name }) - .finish() - } - } - - impl ::fmt::Debug for iwreq { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("iwreq") - .field("ifr_ifrn", &self.ifr_ifrn ) - .field("u", &self.u ) - .finish() - } - } - } -} - cfg_if! { if #[cfg(any(target_env = "gnu", target_env = "musl", target_env = "ohos"))] { pub const ABDAY_1: ::nl_item = 0x20000; diff --git a/src/unix/linux_like/linux/musl/b32/arm/align.rs b/src/unix/linux_like/linux/musl/b32/arm/align.rs index aedbf7a99eb1b..cb1ab5d22a396 100644 --- a/src/unix/linux_like/linux/musl/b32/arm/align.rs +++ b/src/unix/linux_like/linux/musl/b32/arm/align.rs @@ -1,5 +1,4 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] +s! { #[repr(align(8))] pub struct max_align_t { priv_: (i64, i64) diff --git a/src/unix/linux_like/linux/musl/b32/arm/mod.rs b/src/unix/linux_like/linux/musl/b32/arm/mod.rs index 3f41f8990a09f..630dd727272eb 100644 --- a/src/unix/linux_like/linux/musl/b32/arm/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/arm/mod.rs @@ -174,10 +174,7 @@ s! { pub arm_cpsr: ::c_ulong, pub fault_address: ::c_ulong, } -} -s_no_extra_traits! { - #[allow(missing_debug_implementations)] pub struct ucontext_t { pub uc_flags: ::c_ulong, pub uc_link: *mut ucontext_t, @@ -188,41 +185,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for ucontext_t { - fn eq(&self, other: &ucontext_t) -> bool { - self.uc_flags == other.uc_flags - && self.uc_link == other.uc_link - && self.uc_stack == other.uc_stack - && self.uc_mcontext == other.uc_mcontext - && self.uc_sigmask == other.uc_sigmask - } - } - impl Eq for ucontext_t {} - impl ::fmt::Debug for ucontext_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ucontext_t") - .field("uc_flags", &self.uc_link) - .field("uc_link", &self.uc_link) - .field("uc_stack", &self.uc_stack) - .field("uc_mcontext", &self.uc_mcontext) - .field("uc_sigmask", &self.uc_sigmask) - .finish() - } - } - impl ::hash::Hash for ucontext_t { - fn hash(&self, state: &mut H) { - self.uc_flags.hash(state); - self.uc_link.hash(state); - self.uc_stack.hash(state); - self.uc_mcontext.hash(state); - self.uc_sigmask.hash(state); - } - } - } -} - pub const SIGSTKSZ: ::size_t = 8192; pub const MINSIGSTKSZ: ::size_t = 2048; diff --git a/src/unix/linux_like/linux/musl/b32/mips/align.rs b/src/unix/linux_like/linux/musl/b32/mips/align.rs index 8c228ebab72ce..7bf5665c2f0cc 100644 --- a/src/unix/linux_like/linux/musl/b32/mips/align.rs +++ b/src/unix/linux_like/linux/musl/b32/mips/align.rs @@ -1,5 +1,4 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] +s! { #[repr(align(8))] pub struct max_align_t { priv_: [f32; 4] diff --git a/src/unix/linux_like/linux/musl/b32/riscv32/align.rs b/src/unix/linux_like/linux/musl/b32/riscv32/align.rs index 048268c96b7a7..1cccf07600821 100644 --- a/src/unix/linux_like/linux/musl/b32/riscv32/align.rs +++ b/src/unix/linux_like/linux/musl/b32/riscv32/align.rs @@ -1,5 +1,4 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] +s! { #[repr(align(8))] pub struct max_align_t { priv_: (i64, f64) diff --git a/src/unix/linux_like/linux/musl/b32/x86/align.rs b/src/unix/linux_like/linux/musl/b32/x86/align.rs index 79544176a88c9..6caf90b391d0b 100644 --- a/src/unix/linux_like/linux/musl/b32/x86/align.rs +++ b/src/unix/linux_like/linux/musl/b32/x86/align.rs @@ -1,5 +1,4 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] +s! { #[repr(align(8))] pub struct max_align_t { priv_: [f64; 3] diff --git a/src/unix/linux_like/linux/musl/b32/x86/mod.rs b/src/unix/linux_like/linux/musl/b32/x86/mod.rs index f43c7ea60f8c7..51f52986515aa 100644 --- a/src/unix/linux_like/linux/musl/b32/x86/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/x86/mod.rs @@ -154,9 +154,7 @@ s! { pub f_namemax: ::c_ulong, __f_spare: [::c_int; 6], } -} -s_no_extra_traits! { pub struct user_fpxregs_struct { pub cwd: ::c_ushort, pub swd: ::c_ushort, @@ -183,109 +181,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for user_fpxregs_struct { - fn eq(&self, other: &user_fpxregs_struct) -> bool { - self.cwd == other.cwd - && self.swd == other.swd - && self.twd == other.twd - && self.fop == other.fop - && self.fip == other.fip - && self.fcs == other.fcs - && self.foo == other.foo - && self.fos == other.fos - && self.mxcsr == other.mxcsr - // Ignore __reserved field - && self.st_space == other.st_space - && self.xmm_space == other.xmm_space - // Ignore padding field - } - } - - impl Eq for user_fpxregs_struct {} - - impl ::fmt::Debug for user_fpxregs_struct { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("user_fpxregs_struct") - .field("cwd", &self.cwd) - .field("swd", &self.swd) - .field("twd", &self.twd) - .field("fop", &self.fop) - .field("fip", &self.fip) - .field("fcs", &self.fcs) - .field("foo", &self.foo) - .field("fos", &self.fos) - .field("mxcsr", &self.mxcsr) - // Ignore __reserved field - .field("st_space", &self.st_space) - .field("xmm_space", &self.xmm_space) - // Ignore padding field - .finish() - } - } - - impl ::hash::Hash for user_fpxregs_struct { - fn hash(&self, state: &mut H) { - self.cwd.hash(state); - self.swd.hash(state); - self.twd.hash(state); - self.fop.hash(state); - self.fip.hash(state); - self.fcs.hash(state); - self.foo.hash(state); - self.fos.hash(state); - self.mxcsr.hash(state); - // Ignore __reserved field - self.st_space.hash(state); - self.xmm_space.hash(state); - // Ignore padding field - } - } - - impl PartialEq for ucontext_t { - fn eq(&self, other: &ucontext_t) -> bool { - self.uc_flags == other.uc_flags - && self.uc_link == other.uc_link - && self.uc_stack == other.uc_stack - && self.uc_mcontext == other.uc_mcontext - && self.uc_sigmask == other.uc_sigmask - && self - .__private - .iter() - .zip(other.__private.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for ucontext_t {} - - impl ::fmt::Debug for ucontext_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ucontext_t") - .field("uc_flags", &self.uc_flags) - .field("uc_link", &self.uc_link) - .field("uc_stack", &self.uc_stack) - .field("uc_mcontext", &self.uc_mcontext) - .field("uc_sigmask", &self.uc_sigmask) - // Ignore __private field - .finish() - } - } - - impl ::hash::Hash for ucontext_t { - fn hash(&self, state: &mut H) { - self.uc_flags.hash(state); - self.uc_link.hash(state); - self.uc_stack.hash(state); - self.uc_mcontext.hash(state); - self.uc_sigmask.hash(state); - self.__private.hash(state); - } - } - } -} - pub const SIGSTKSZ: ::size_t = 8192; pub const MINSIGSTKSZ: ::size_t = 2048; diff --git a/src/unix/linux_like/linux/musl/b64/aarch64/align.rs b/src/unix/linux_like/linux/musl/b64/aarch64/align.rs index a4bf9bff4f147..22f2df656d874 100644 --- a/src/unix/linux_like/linux/musl/b64/aarch64/align.rs +++ b/src/unix/linux_like/linux/musl/b64/aarch64/align.rs @@ -1,12 +1,9 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] +s! { #[repr(align(16))] pub struct max_align_t { priv_: [f32; 8] } -} -s! { pub struct ucontext_t { pub uc_flags: ::c_ulong, pub uc_link: *mut ucontext_t, diff --git a/src/unix/linux_like/linux/musl/b64/loongarch64/align.rs b/src/unix/linux_like/linux/musl/b64/loongarch64/align.rs index dc191f51fdb1c..6df12fb97aad9 100644 --- a/src/unix/linux_like/linux/musl/b64/loongarch64/align.rs +++ b/src/unix/linux_like/linux/musl/b64/loongarch64/align.rs @@ -1,12 +1,9 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] +s! { #[repr(align(16))] pub struct max_align_t { priv_: [f64; 4] } -} -s! { pub struct ucontext_t { pub uc_flags: ::c_ulong, pub uc_link: *mut ucontext_t, diff --git a/src/unix/linux_like/linux/musl/b64/riscv64/align.rs b/src/unix/linux_like/linux/musl/b64/riscv64/align.rs index 48d152a5721ec..6d0eded3c84fd 100644 --- a/src/unix/linux_like/linux/musl/b64/riscv64/align.rs +++ b/src/unix/linux_like/linux/musl/b64/riscv64/align.rs @@ -1,5 +1,4 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] +s! { pub struct ucontext_t { pub __uc_flags: ::c_ulong, pub uc_link: *mut ucontext_t, @@ -8,33 +7,28 @@ s_no_extra_traits! { pub uc_mcontext: mcontext_t, } - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct mcontext_t { pub __gregs: [::c_ulong; 32], pub __fpregs: __riscv_mc_fp_state, } - #[allow(missing_debug_implementations)] pub union __riscv_mc_fp_state { pub __f: __riscv_mc_f_ext_state, pub __d: __riscv_mc_d_ext_state, pub __q: __riscv_mc_q_ext_state, } - #[allow(missing_debug_implementations)] pub struct __riscv_mc_f_ext_state { pub __f: [::c_uint; 32], pub __fcsr: ::c_uint, } - #[allow(missing_debug_implementations)] pub struct __riscv_mc_d_ext_state { pub __f: [::c_ulonglong; 32], pub __fcsr: ::c_uint, } - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct __riscv_mc_q_ext_state { pub __f: [::c_ulonglong; 64], diff --git a/src/unix/linux_like/linux/musl/b64/s390x.rs b/src/unix/linux_like/linux/musl/b64/s390x.rs index aa4cbf87f8a22..a8b9d7fd87c18 100644 --- a/src/unix/linux_like/linux/musl/b64/s390x.rs +++ b/src/unix/linux_like/linux/musl/b64/s390x.rs @@ -88,9 +88,7 @@ s! { pub f_flags: ::c_uint, pub f_spare: [::c_uint; 4], } -} -s_no_extra_traits! { // FIXME: This is actually a union. pub struct fpreg_t { pub d: ::c_double, @@ -98,33 +96,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for fpreg_t { - fn eq(&self, other: &fpreg_t) -> bool { - self.d == other.d - } - } - - impl Eq for fpreg_t {} - - impl ::fmt::Debug for fpreg_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("fpreg_t") - .field("d", &self.d) - .finish() - } - } - - impl ::hash::Hash for fpreg_t { - fn hash(&self, state: &mut H) { - let d: u64 = unsafe { ::mem::transmute(self.d) }; - d.hash(state); - } - } - } -} - pub const VEOF: usize = 4; pub const RTLD_DEEPBIND: ::c_int = 0x8; diff --git a/src/unix/linux_like/linux/musl/b64/x86_64/align.rs b/src/unix/linux_like/linux/musl/b64/x86_64/align.rs index 94391a01a727e..8d7623ab45c35 100644 --- a/src/unix/linux_like/linux/musl/b64/x86_64/align.rs +++ b/src/unix/linux_like/linux/musl/b64/x86_64/align.rs @@ -1,13 +1,9 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] +s! { #[repr(align(16))] pub struct max_align_t { priv_: [f64; 4] } -} - -s! { #[repr(align(8))] pub struct clone_args { pub flags: ::c_ulonglong, diff --git a/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs b/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs index f1c9f5af90c0f..122d22b9e672e 100644 --- a/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs @@ -120,9 +120,7 @@ s! { __unused1: ::c_long, __unused2: ::c_long } -} -s_no_extra_traits! { pub struct user_fpregs_struct { pub cwd: ::c_ushort, pub swd: ::c_ushort, @@ -147,105 +145,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for user_fpregs_struct { - fn eq(&self, other: &user_fpregs_struct) -> bool { - self.cwd == other.cwd - && self.swd == other.swd - && self.ftw == other.ftw - && self.fop == other.fop - && self.rip == other.rip - && self.rdp == other.rdp - && self.mxcsr == other.mxcsr - && self.mxcr_mask == other.mxcr_mask - && self.st_space == other.st_space - && self - .xmm_space - .iter() - .zip(other.xmm_space.iter()) - .all(|(a,b)| a == b) - // Ignore padding field - } - } - - impl Eq for user_fpregs_struct {} - - impl ::fmt::Debug for user_fpregs_struct { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("user_fpregs_struct") - .field("cwd", &self.cwd) - .field("ftw", &self.ftw) - .field("fop", &self.fop) - .field("rip", &self.rip) - .field("rdp", &self.rdp) - .field("mxcsr", &self.mxcsr) - .field("mxcr_mask", &self.mxcr_mask) - .field("st_space", &self.st_space) - // FIXME: .field("xmm_space", &self.xmm_space) - // Ignore padding field - .finish() - } - } - - impl ::hash::Hash for user_fpregs_struct { - fn hash(&self, state: &mut H) { - self.cwd.hash(state); - self.ftw.hash(state); - self.fop.hash(state); - self.rip.hash(state); - self.rdp.hash(state); - self.mxcsr.hash(state); - self.mxcr_mask.hash(state); - self.st_space.hash(state); - self.xmm_space.hash(state); - // Ignore padding field - } - } - - impl PartialEq for ucontext_t { - fn eq(&self, other: &ucontext_t) -> bool { - self.uc_flags == other.uc_flags - && self.uc_link == other.uc_link - && self.uc_stack == other.uc_stack - && self.uc_mcontext == other.uc_mcontext - && self.uc_sigmask == other.uc_sigmask - && self - .__private - .iter() - .zip(other.__private.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for ucontext_t {} - - impl ::fmt::Debug for ucontext_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ucontext_t") - .field("uc_flags", &self.uc_flags) - .field("uc_link", &self.uc_link) - .field("uc_stack", &self.uc_stack) - .field("uc_mcontext", &self.uc_mcontext) - .field("uc_sigmask", &self.uc_sigmask) - // Ignore __private field - .finish() - } - } - - impl ::hash::Hash for ucontext_t { - fn hash(&self, state: &mut H) { - self.uc_flags.hash(state); - self.uc_link.hash(state); - self.uc_stack.hash(state); - self.uc_mcontext.hash(state); - self.uc_sigmask.hash(state); - self.__private.hash(state); - } - } - } -} - // Syscall table pub const SYS_read: ::c_long = 0; diff --git a/src/unix/linux_like/linux/musl/mod.rs b/src/unix/linux_like/linux/musl/mod.rs index f8a7a62b17d79..ae0d6a0810ee4 100644 --- a/src/unix/linux_like/linux/musl/mod.rs +++ b/src/unix/linux_like/linux/musl/mod.rs @@ -344,9 +344,7 @@ s! { pub len: ::__u32, pub options: ::__u32, } -} -s_no_extra_traits! { pub struct sysinfo { pub uptime: ::c_ulong, pub loads: [::c_ulong; 3], @@ -404,137 +402,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for sysinfo { - fn eq(&self, other: &sysinfo) -> bool { - self.uptime == other.uptime - && self.loads == other.loads - && self.totalram == other.totalram - && self.freeram == other.freeram - && self.sharedram == other.sharedram - && self.bufferram == other.bufferram - && self.totalswap == other.totalswap - && self.freeswap == other.freeswap - && self.procs == other.procs - && self.pad == other.pad - && self.totalhigh == other.totalhigh - && self.freehigh == other.freehigh - && self.mem_unit == other.mem_unit - && self - .__reserved - .iter() - .zip(other.__reserved.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for sysinfo {} - - impl ::fmt::Debug for sysinfo { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sysinfo") - .field("uptime", &self.uptime) - .field("loads", &self.loads) - .field("totalram", &self.totalram) - .field("freeram", &self.freeram) - .field("sharedram", &self.sharedram) - .field("bufferram", &self.bufferram) - .field("totalswap", &self.totalswap) - .field("freeswap", &self.freeswap) - .field("procs", &self.procs) - .field("pad", &self.pad) - .field("totalhigh", &self.totalhigh) - .field("freehigh", &self.freehigh) - .field("mem_unit", &self.mem_unit) - // FIXME: .field("__reserved", &self.__reserved) - .finish() - } - } - - impl ::hash::Hash for sysinfo { - fn hash(&self, state: &mut H) { - self.uptime.hash(state); - self.loads.hash(state); - self.totalram.hash(state); - self.freeram.hash(state); - self.sharedram.hash(state); - self.bufferram.hash(state); - self.totalswap.hash(state); - self.freeswap.hash(state); - self.procs.hash(state); - self.pad.hash(state); - self.totalhigh.hash(state); - self.freehigh.hash(state); - self.mem_unit.hash(state); - self.__reserved.hash(state); - } - } - - impl PartialEq for utmpx { - fn eq(&self, other: &utmpx) -> bool { - self.ut_type == other.ut_type - //&& self.__ut_pad1 == other.__ut_pad1 - && self.ut_pid == other.ut_pid - && self.ut_line == other.ut_line - && self.ut_id == other.ut_id - && self.ut_user == other.ut_user - && self - .ut_host - .iter() - .zip(other.ut_host.iter()) - .all(|(a,b)| a == b) - && self.ut_exit == other.ut_exit - && self.ut_session == other.ut_session - //&& self.__ut_pad2 == other.__ut_pad2 - && self.ut_tv == other.ut_tv - && self.ut_addr_v6 == other.ut_addr_v6 - && self.__unused == other.__unused - } - } - - impl Eq for utmpx {} - - impl ::fmt::Debug for utmpx { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("utmpx") - .field("ut_type", &self.ut_type) - //.field("__ut_pad1", &self.__ut_pad1) - .field("ut_pid", &self.ut_pid) - .field("ut_line", &self.ut_line) - .field("ut_id", &self.ut_id) - .field("ut_user", &self.ut_user) - //FIXME: .field("ut_host", &self.ut_host) - .field("ut_exit", &self.ut_exit) - .field("ut_session", &self.ut_session) - //.field("__ut_pad2", &self.__ut_pad2) - .field("ut_tv", &self.ut_tv) - .field("ut_addr_v6", &self.ut_addr_v6) - .field("__unused", &self.__unused) - .finish() - } - } - - impl ::hash::Hash for utmpx { - fn hash(&self, state: &mut H) { - self.ut_type.hash(state); - //self.__ut_pad1.hash(state); - self.ut_pid.hash(state); - self.ut_line.hash(state); - self.ut_id.hash(state); - self.ut_user.hash(state); - self.ut_host.hash(state); - self.ut_exit.hash(state); - self.ut_session.hash(state); - //self.__ut_pad2.hash(state); - self.ut_tv.hash(state); - self.ut_addr_v6.hash(state); - self.__unused.hash(state); - } - } - } -} - // include/sys/mman.h /* * Huge page size encoding when MAP_HUGETLB is specified, and a huge page diff --git a/src/unix/linux_like/linux/uclibc/x86_64/l4re.rs b/src/unix/linux_like/linux/uclibc/x86_64/l4re.rs index 56a0e37f6dfcb..cd725f36bdee1 100644 --- a/src/unix/linux_like/linux/uclibc/x86_64/l4re.rs +++ b/src/unix/linux_like/linux/uclibc/x86_64/l4re.rs @@ -27,7 +27,6 @@ s! { } #[cfg(target_os = "l4re")] -#[allow(missing_debug_implementations)] pub struct pthread_attr_t { pub __detachstate: ::c_int, pub __schedpolicy: ::c_int, diff --git a/src/unix/linux_like/linux/uclibc/x86_64/mod.rs b/src/unix/linux_like/linux/uclibc/x86_64/mod.rs index 384566c5bf379..aea813bca8813 100644 --- a/src/unix/linux_like/linux/uclibc/x86_64/mod.rs +++ b/src/unix/linux_like/linux/uclibc/x86_64/mod.rs @@ -266,10 +266,7 @@ s! { pub cmsg_level: ::c_int, pub cmsg_type: ::c_int, } -} -s_no_extra_traits! { - #[allow(missing_debug_implementations)] pub struct dirent { pub d_ino: ::ino64_t, pub d_off: ::off64_t, diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index bdbec9c651fc5..028139fabb75a 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -7,7 +7,6 @@ pub type key_t = ::c_int; pub type id_t = ::c_uint; missing! { - #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum timezone {} } @@ -204,9 +203,7 @@ s! { pub msg_hdr: ::msghdr, pub msg_len: ::c_uint, } -} -s_no_extra_traits! { #[cfg_attr( any( all( @@ -257,182 +254,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for epoll_event { - fn eq(&self, other: &epoll_event) -> bool { - self.events == other.events - && self.u64 == other.u64 - } - } - impl Eq for epoll_event {} - impl ::fmt::Debug for epoll_event { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let events = self.events; - let u64 = self.u64; - f.debug_struct("epoll_event") - .field("events", &events) - .field("u64", &u64) - .finish() - } - } - impl ::hash::Hash for epoll_event { - fn hash(&self, state: &mut H) { - let events = self.events; - let u64 = self.u64; - events.hash(state); - u64.hash(state); - } - } - - impl PartialEq for sockaddr_un { - fn eq(&self, other: &sockaddr_un) -> bool { - self.sun_family == other.sun_family - && self - .sun_path - .iter() - .zip(other.sun_path.iter()) - .all(|(a, b)| a == b) - } - } - impl Eq for sockaddr_un {} - impl ::fmt::Debug for sockaddr_un { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_un") - .field("sun_family", &self.sun_family) - // FIXME: .field("sun_path", &self.sun_path) - .finish() - } - } - impl ::hash::Hash for sockaddr_un { - fn hash(&self, state: &mut H) { - self.sun_family.hash(state); - self.sun_path.hash(state); - } - } - - impl PartialEq for sockaddr_storage { - fn eq(&self, other: &sockaddr_storage) -> bool { - self.ss_family == other.ss_family - && self - .__ss_pad2 - .iter() - .zip(other.__ss_pad2.iter()) - .all(|(a, b)| a == b) - } - } - - impl Eq for sockaddr_storage {} - - impl ::fmt::Debug for sockaddr_storage { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_storage") - .field("ss_family", &self.ss_family) - .field("__ss_align", &self.__ss_align) - // FIXME: .field("__ss_pad2", &self.__ss_pad2) - .finish() - } - } - - impl ::hash::Hash for sockaddr_storage { - fn hash(&self, state: &mut H) { - self.ss_family.hash(state); - self.__ss_pad2.hash(state); - } - } - - impl PartialEq for utsname { - fn eq(&self, other: &utsname) -> bool { - self.sysname - .iter() - .zip(other.sysname.iter()) - .all(|(a, b)| a == b) - && self - .nodename - .iter() - .zip(other.nodename.iter()) - .all(|(a, b)| a == b) - && self - .release - .iter() - .zip(other.release.iter()) - .all(|(a, b)| a == b) - && self - .version - .iter() - .zip(other.version.iter()) - .all(|(a, b)| a == b) - && self - .machine - .iter() - .zip(other.machine.iter()) - .all(|(a, b)| a == b) - && self - .domainname - .iter() - .zip(other.domainname.iter()) - .all(|(a, b)| a == b) - } - } - - impl Eq for utsname {} - - impl ::fmt::Debug for utsname { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("utsname") - // FIXME: .field("sysname", &self.sysname) - // FIXME: .field("nodename", &self.nodename) - // FIXME: .field("release", &self.release) - // FIXME: .field("version", &self.version) - // FIXME: .field("machine", &self.machine) - // FIXME: .field("domainname", &self.domainname) - .finish() - } - } - - impl ::hash::Hash for utsname { - fn hash(&self, state: &mut H) { - self.sysname.hash(state); - self.nodename.hash(state); - self.release.hash(state); - self.version.hash(state); - self.machine.hash(state); - self.domainname.hash(state); - } - } - - impl PartialEq for sigevent { - fn eq(&self, other: &sigevent) -> bool { - self.sigev_value == other.sigev_value - && self.sigev_signo == other.sigev_signo - && self.sigev_notify == other.sigev_notify - && self.sigev_notify_thread_id - == other.sigev_notify_thread_id - } - } - impl Eq for sigevent {} - impl ::fmt::Debug for sigevent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sigevent") - .field("sigev_value", &self.sigev_value) - .field("sigev_signo", &self.sigev_signo) - .field("sigev_notify", &self.sigev_notify) - .field("sigev_notify_thread_id", - &self.sigev_notify_thread_id) - .finish() - } - } - impl ::hash::Hash for sigevent { - fn hash(&self, state: &mut H) { - self.sigev_value.hash(state); - self.sigev_signo.hash(state); - self.sigev_notify.hash(state); - self.sigev_notify_thread_id.hash(state); - } - } - } -} - // intentionally not public, only used for fd_set cfg_if! { if #[cfg(target_pointer_width = "32")] { diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 51984bc2c42c2..e7cb4c5016b20 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -42,7 +42,6 @@ cfg_if! { } missing! { - #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum DIR {} } pub type locale_t = *mut ::c_void; @@ -411,9 +410,7 @@ cfg_if! { } missing! { - #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum FILE {} - #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum fpos_t {} // FIXME: fill this out with a struct } diff --git a/src/unix/nto/mod.rs b/src/unix/nto/mod.rs index f00d710bbac02..e34c5b3ee4e6a 100644 --- a/src/unix/nto/mod.rs +++ b/src/unix/nto/mod.rs @@ -70,7 +70,6 @@ pub type sem_t = sync_t; pub type nl_item = ::c_int; -#[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum timezone {} impl ::Copy for timezone {} impl ::Clone for timezone { @@ -641,9 +640,7 @@ s! { pub uc_stack: stack_t, pub uc_mcontext: mcontext_t, } -} -s_no_extra_traits! { pub struct sockaddr_un { pub sun_len: u8, pub sun_family: sa_family_t, @@ -756,400 +753,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - // sigevent - impl PartialEq for sigevent { - fn eq(&self, other: &sigevent) -> bool { - self.sigev_notify == other.sigev_notify - && self.sigev_signo == other.sigev_signo - && self.sigev_value == other.sigev_value - && self.__sigev_un2 - == other.__sigev_un2 - } - } - impl Eq for sigevent {} - impl ::fmt::Debug for sigevent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sigevent") - .field("sigev_notify", &self.sigev_notify) - .field("sigev_signo", &self.sigev_signo) - .field("sigev_value", &self.sigev_value) - .field("__sigev_un2", - &self.__sigev_un2) - .finish() - } - } - impl ::hash::Hash for sigevent { - fn hash(&self, state: &mut H) { - self.sigev_notify.hash(state); - self.sigev_signo.hash(state); - self.sigev_value.hash(state); - self.__sigev_un2.hash(state); - } - } - - impl PartialEq for sockaddr_un { - fn eq(&self, other: &sockaddr_un) -> bool { - self.sun_len == other.sun_len - && self.sun_family == other.sun_family - && self - .sun_path - .iter() - .zip(other.sun_path.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for sockaddr_un {} - impl ::fmt::Debug for sockaddr_un { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_un") - .field("sun_len", &self.sun_len) - .field("sun_family", &self.sun_family) - // FIXME: .field("sun_path", &self.sun_path) - .finish() - } - } - - impl ::hash::Hash for sockaddr_un { - fn hash(&self, state: &mut H) { - self.sun_len.hash(state); - self.sun_family.hash(state); - self.sun_path.hash(state); - } - } - - // sigset_t - impl PartialEq for sigset_t { - fn eq(&self, other: &sigset_t) -> bool { - self.__val == other.__val - } - } - impl Eq for sigset_t {} - impl ::fmt::Debug for sigset_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sigset_t") - .field("__val", &self.__val) - .finish() - } - } - impl ::hash::Hash for sigset_t { - fn hash(&self, state: &mut H) { - self.__val.hash(state); - } - } - - // msg - impl ::fmt::Debug for msg { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("msg") - .field("msg_next", &self.msg_next) - .field("msg_type", &self.msg_type) - .field("msg_ts", &self.msg_ts) - .field("msg_spot", &self.msg_spot) - .finish() - } - } - - // msqid_ds - impl ::fmt::Debug for msqid_ds { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("msqid_ds") - .field("msg_perm", &self.msg_perm) - .field("msg_first", &self.msg_first) - .field("msg_cbytes", &self.msg_cbytes) - .field("msg_qnum", &self.msg_qnum) - .field("msg_qbytes", &self.msg_qbytes) - .field("msg_lspid", &self.msg_lspid) - .field("msg_lrpid", &self.msg_lrpid) - .field("msg_stime", &self.msg_stime) - .field("msg_rtime", &self.msg_rtime) - .field("msg_ctime", &self.msg_ctime) - .finish() - } - } - - // sockaddr_dl - impl ::fmt::Debug for sockaddr_dl { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_dl") - .field("sdl_len", &self.sdl_len) - .field("sdl_family", &self.sdl_family) - .field("sdl_index", &self.sdl_index) - .field("sdl_type", &self.sdl_type) - .field("sdl_nlen", &self.sdl_nlen) - .field("sdl_alen", &self.sdl_alen) - .field("sdl_slen", &self.sdl_slen) - .field("sdl_data", &self.sdl_data) - .finish() - } - } - impl PartialEq for sockaddr_dl { - fn eq(&self, other: &sockaddr_dl) -> bool { - self.sdl_len == other.sdl_len - && self.sdl_family == other.sdl_family - && self.sdl_index == other.sdl_index - && self.sdl_type == other.sdl_type - && self.sdl_nlen == other.sdl_nlen - && self.sdl_alen == other.sdl_alen - && self.sdl_slen == other.sdl_slen - && self - .sdl_data - .iter() - .zip(other.sdl_data.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for sockaddr_dl {} - impl ::hash::Hash for sockaddr_dl { - fn hash(&self, state: &mut H) { - self.sdl_len.hash(state); - self.sdl_family.hash(state); - self.sdl_index.hash(state); - self.sdl_type.hash(state); - self.sdl_nlen.hash(state); - self.sdl_alen.hash(state); - self.sdl_slen.hash(state); - self.sdl_data.hash(state); - } - } - - // sync_t - impl ::fmt::Debug for sync_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sync_t") - .field("__owner", &self.__owner) - .field("__u", &self.__u) - .finish() - } - } - - // pthread_barrier_t - impl ::fmt::Debug for pthread_barrier_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("pthread_barrier_t") - .field("__pad", &self.__pad) - .finish() - } - } - - // pthread_rwlock_t - impl ::fmt::Debug for pthread_rwlock_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("pthread_rwlock_t") - .field("__active", &self.__active) - .field("__blockedwriters", &self.__blockedwriters) - .field("__blockedreaders", &self.__blockedreaders) - .field("__heavy", &self.__heavy) - .field("__lock", &self.__lock) - .field("__rcond", &self.__rcond) - .field("__wcond", &self.__wcond) - .field("__owner", &self.__owner) - .field("__spare", &self.__spare) - .finish() - } - } - - // syspage_entry - impl ::fmt::Debug for syspage_entry { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("syspage_entry") - .field("size", &self.size) - .field("total_size", &self.total_size) - .field("type_", &self.type_) - .field("num_cpu", &self.num_cpu) - .field("system_private", &self.system_private) - .field("old_asinfo", &self.old_asinfo) - .field("hwinfo", &self.hwinfo) - .field("old_cpuinfo", &self.old_cpuinfo) - .field("old_cacheattr", &self.old_cacheattr) - .field("qtime", &self.qtime) - .field("callout", &self.callout) - .field("callin", &self.callin) - .field("typed_strings", &self.typed_strings) - .field("strings", &self.strings) - .field("old_intrinfo", &self.old_intrinfo) - .field("smp", &self.smp) - .field("pminfo", &self.pminfo) - .field("old_mdriver", &self.old_mdriver) - .field("new_asinfo", &self.new_asinfo) - .field("new_cpuinfo", &self.new_cpuinfo) - .field("new_cacheattr", &self.new_cacheattr) - .field("new_intrinfo", &self.new_intrinfo) - .field("new_mdriver", &self.new_mdriver) - .finish() - } - } - - impl PartialEq for utsname { - fn eq(&self, other: &utsname) -> bool { - self.sysname - .iter() - .zip(other.sysname.iter()) - .all(|(a,b)| a == b) - && self - .nodename - .iter() - .zip(other.nodename.iter()) - .all(|(a,b)| a == b) - && self - .release - .iter() - .zip(other.release.iter()) - .all(|(a,b)| a == b) - && self - .version - .iter() - .zip(other.version.iter()) - .all(|(a,b)| a == b) - && self - .machine - .iter() - .zip(other.machine.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for utsname {} - - impl ::fmt::Debug for utsname { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("utsname") - // FIXME: .field("sysname", &self.sysname) - // FIXME: .field("nodename", &self.nodename) - // FIXME: .field("release", &self.release) - // FIXME: .field("version", &self.version) - // FIXME: .field("machine", &self.machine) - .finish() - } - } - - impl ::hash::Hash for utsname { - fn hash(&self, state: &mut H) { - self.sysname.hash(state); - self.nodename.hash(state); - self.release.hash(state); - self.version.hash(state); - self.machine.hash(state); - } - } - - impl PartialEq for mq_attr { - fn eq(&self, other: &mq_attr) -> bool { - self.mq_maxmsg == other.mq_maxmsg && - self.mq_msgsize == other.mq_msgsize && - self.mq_flags == other.mq_flags && - self.mq_curmsgs == other.mq_curmsgs && - self.mq_msgsize == other.mq_msgsize && - self.mq_sendwait == other.mq_sendwait && - self.mq_recvwait == other.mq_recvwait - } - } - - impl Eq for mq_attr {} - - impl ::fmt::Debug for mq_attr { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("mq_attr") - .field("mq_maxmsg", &self.mq_maxmsg) - .field("mq_msgsize", &self.mq_msgsize) - .field("mq_flags", &self.mq_flags) - .field("mq_curmsgs", &self.mq_curmsgs) - .field("mq_msgsize", &self.mq_msgsize) - .field("mq_sendwait", &self.mq_sendwait) - .field("mq_recvwait", &self.mq_recvwait) - .finish() - } - } - impl ::hash::Hash for mq_attr { - fn hash(&self, state: &mut H) { - self.mq_maxmsg.hash(state); - self.mq_msgsize.hash(state); - self.mq_flags.hash(state); - self.mq_curmsgs.hash(state); - self.mq_sendwait.hash(state); - self.mq_recvwait.hash(state); - } - } - - impl PartialEq for sockaddr_storage { - fn eq(&self, other: &sockaddr_storage) -> bool { - self.ss_len == other.ss_len - && self.ss_family == other.ss_family - && self.__ss_pad1 == other.__ss_pad1 - && self.__ss_align == other.__ss_align - && self - .__ss_pad2 - .iter() - .zip(other.__ss_pad2.iter()) - .all(|(a, b)| a == b) - } - } - - impl Eq for sockaddr_storage {} - - impl ::fmt::Debug for sockaddr_storage { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_storage") - .field("ss_len", &self.ss_len) - .field("ss_family", &self.ss_family) - .field("__ss_pad1", &self.__ss_pad1) - .field("__ss_align", &self.__ss_align) - // FIXME: .field("__ss_pad2", &self.__ss_pad2) - .finish() - } - } - - impl ::hash::Hash for sockaddr_storage { - fn hash(&self, state: &mut H) { - self.ss_len.hash(state); - self.ss_family.hash(state); - self.__ss_pad1.hash(state); - self.__ss_align.hash(state); - self.__ss_pad2.hash(state); - } - } - - impl PartialEq for dirent { - fn eq(&self, other: &dirent) -> bool { - self.d_ino == other.d_ino - && self.d_offset == other.d_offset - && self.d_reclen == other.d_reclen - && self.d_namelen == other.d_namelen - && self - .d_name[..self.d_namelen as _] - .iter() - .zip(other.d_name.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for dirent {} - - impl ::fmt::Debug for dirent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("dirent") - .field("d_ino", &self.d_ino) - .field("d_offset", &self.d_offset) - .field("d_reclen", &self.d_reclen) - .field("d_namelen", &self.d_namelen) - .field("d_name", &&self.d_name[..self.d_namelen as _]) - .finish() - } - } - - impl ::hash::Hash for dirent { - fn hash(&self, state: &mut H) { - self.d_ino.hash(state); - self.d_offset.hash(state); - self.d_reclen.hash(state); - self.d_namelen.hash(state); - self.d_name[..self.d_namelen as _].hash(state); - } - } - } -} - pub const _SYSNAME_SIZE: usize = 256 + 1; pub const RLIM_INFINITY: ::rlim_t = 0xfffffffffffffffd; pub const O_LARGEFILE: ::c_int = 0o0100000; diff --git a/src/unix/nto/neutrino.rs b/src/unix/nto/neutrino.rs index 1a6f7da9cece2..15e85ad8e5742 100644 --- a/src/unix/nto/neutrino.rs +++ b/src/unix/nto/neutrino.rs @@ -209,9 +209,6 @@ s! { pub nsec: u32, pub fract: i32, } -} - -s_no_extra_traits! { #[repr(align(8))] pub struct syspage_entry { diff --git a/src/unix/nto/x86_64.rs b/src/unix/nto/x86_64.rs index 29739ac83a3e9..48690b8699198 100644 --- a/src/unix/nto/x86_64.rs +++ b/src/unix/nto/x86_64.rs @@ -74,9 +74,7 @@ s! { pub xstate_undef: [u64; 7], pub xstate_info: [u8; 224], } -} -s_no_extra_traits! { pub union x86_64_fpu_registers { pub fsave_area: fsave_area_64, pub fxsave_area: fxsave_area_64, @@ -84,41 +82,3 @@ s_no_extra_traits! { pub data: [u8; 1024], } } - -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl Eq for x86_64_fpu_registers {} - - impl PartialEq for x86_64_fpu_registers { - fn eq(&self, other: &x86_64_fpu_registers) -> bool { - unsafe { - self.fsave_area == other.fsave_area - || self.fxsave_area == other.fxsave_area - || self.xsave_area == other.xsave_area - } - } - } - - impl ::fmt::Debug for x86_64_fpu_registers { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - unsafe { - f.debug_struct("x86_64_fpu_registers") - .field("fsave_area", &self.fsave_area) - .field("fxsave_area", &self.fxsave_area) - .field("xsave_area", &self.xsave_area) - .finish() - } - } - } - - impl ::hash::Hash for x86_64_fpu_registers { - fn hash(&self, state: &mut H) { - unsafe { - self.fsave_area.hash(state); - self.fxsave_area.hash(state); - self.xsave_area.hash(state); - } - } - } - } -} diff --git a/src/unix/redox/mod.rs b/src/unix/redox/mod.rs index bc6e2a8a93d4e..fc27a7e173875 100644 --- a/src/unix/redox/mod.rs +++ b/src/unix/redox/mod.rs @@ -45,7 +45,6 @@ pub type pid_t = usize; pub type uid_t = u32; pub type gid_t = u32; -#[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum timezone {} impl ::Copy for timezone {} impl ::Clone for timezone { @@ -54,7 +53,7 @@ impl ::Clone for timezone { } } -s_no_extra_traits! { +s! { #[repr(C)] pub struct utsname { pub sysname: [::c_char; UTSLENGTH], @@ -88,9 +87,7 @@ s_no_extra_traits! { ], __ss_align: ::c_ulong, } -} -s! { pub struct addrinfo { pub ai_flags: ::c_int, pub ai_family: ::c_int, @@ -1258,166 +1255,3 @@ extern "C" { // utmp.h pub fn login_tty(fd: ::c_int) -> ::c_int; } - -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for dirent { - fn eq(&self, other: &dirent) -> bool { - self.d_ino == other.d_ino - && self.d_off == other.d_off - && self.d_reclen == other.d_reclen - && self.d_type == other.d_type - && self - .d_name - .iter() - .zip(other.d_name.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for dirent {} - - impl ::fmt::Debug for dirent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("dirent") - .field("d_ino", &self.d_ino) - .field("d_off", &self.d_off) - .field("d_reclen", &self.d_reclen) - .field("d_type", &self.d_type) - // FIXME: .field("d_name", &self.d_name) - .finish() - } - } - - impl ::hash::Hash for dirent { - fn hash(&self, state: &mut H) { - self.d_ino.hash(state); - self.d_off.hash(state); - self.d_reclen.hash(state); - self.d_type.hash(state); - self.d_name.hash(state); - } - } - - impl PartialEq for sockaddr_un { - fn eq(&self, other: &sockaddr_un) -> bool { - self.sun_family == other.sun_family - && self - .sun_path - .iter() - .zip(other.sun_path.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for sockaddr_un {} - - impl ::fmt::Debug for sockaddr_un { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_un") - .field("sun_family", &self.sun_family) - // FIXME: .field("sun_path", &self.sun_path) - .finish() - } - } - - impl ::hash::Hash for sockaddr_un { - fn hash(&self, state: &mut H) { - self.sun_family.hash(state); - self.sun_path.hash(state); - } - } - - impl PartialEq for sockaddr_storage { - fn eq(&self, other: &sockaddr_storage) -> bool { - self.ss_family == other.ss_family - && self.__ss_align == self.__ss_align - && self - .__ss_padding - .iter() - .zip(other.__ss_padding.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for sockaddr_storage {} - - impl ::fmt::Debug for sockaddr_storage { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_storage") - .field("ss_family", &self.ss_family) - .field("__ss_align", &self.__ss_align) - // FIXME: .field("__ss_padding", &self.__ss_padding) - .finish() - } - } - - impl ::hash::Hash for sockaddr_storage { - fn hash(&self, state: &mut H) { - self.ss_family.hash(state); - self.__ss_padding.hash(state); - self.__ss_align.hash(state); - } - } - - impl PartialEq for utsname { - fn eq(&self, other: &utsname) -> bool { - self.sysname - .iter() - .zip(other.sysname.iter()) - .all(|(a, b)| a == b) - && self - .nodename - .iter() - .zip(other.nodename.iter()) - .all(|(a, b)| a == b) - && self - .release - .iter() - .zip(other.release.iter()) - .all(|(a, b)| a == b) - && self - .version - .iter() - .zip(other.version.iter()) - .all(|(a, b)| a == b) - && self - .machine - .iter() - .zip(other.machine.iter()) - .all(|(a, b)| a == b) - && self - .domainname - .iter() - .zip(other.domainname.iter()) - .all(|(a, b)| a == b) - } - } - - impl Eq for utsname {} - - impl ::fmt::Debug for utsname { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("utsname") - // FIXME: .field("sysname", &self.sysname) - // FIXME: .field("nodename", &self.nodename) - // FIXME: .field("release", &self.release) - // FIXME: .field("version", &self.version) - // FIXME: .field("machine", &self.machine) - // FIXME: .field("domainname", &self.domainname) - .finish() - } - } - - impl ::hash::Hash for utsname { - fn hash(&self, state: &mut H) { - self.sysname.hash(state); - self.nodename.hash(state); - self.release.hash(state); - self.version.hash(state); - self.machine.hash(state); - self.domainname.hash(state); - } - } - } -} diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs index 77e0afdf19622..a120822050a06 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -55,7 +55,6 @@ pub type lgrp_lat_between_t = ::c_uint; pub type lgrp_mem_size_flag_t = ::c_uint; pub type lgrp_view_t = ::c_uint; -#[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum timezone {} impl ::Copy for timezone {} impl ::Clone for timezone { @@ -64,7 +63,6 @@ impl ::Clone for timezone { } } -#[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum ucred_t {} impl ::Copy for ucred_t {} impl ::Clone for ucred_t { @@ -473,9 +471,7 @@ s! { pub flag: *mut ::c_int, pub val: ::c_int, } -} -s_no_extra_traits! { #[cfg_attr(any( target_arch = "x86", target_arch = "x86_64"), repr(packed(4)) @@ -569,424 +565,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for utmpx { - fn eq(&self, other: &utmpx) -> bool { - self.ut_type == other.ut_type - && self.ut_pid == other.ut_pid - && self.ut_user == other.ut_user - && self.ut_line == other.ut_line - && self.ut_id == other.ut_id - && self.ut_exit == other.ut_exit - && self.ut_session == other.ut_session - && self.ut_tv == other.ut_tv - && self.ut_syslen == other.ut_syslen - && self.ut_pad == other.ut_pad - && self - .ut_host - .iter() - .zip(other.ut_host.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for utmpx {} - - impl ::fmt::Debug for utmpx { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("utmpx") - .field("ut_user", &self.ut_user) - .field("ut_id", &self.ut_id) - .field("ut_line", &self.ut_line) - .field("ut_pid", &self.ut_pid) - .field("ut_type", &self.ut_type) - .field("ut_exit", &self.ut_exit) - .field("ut_tv", &self.ut_tv) - .field("ut_session", &self.ut_session) - .field("ut_pad", &self.ut_pad) - .field("ut_syslen", &self.ut_syslen) - .field("ut_host", &&self.ut_host[..]) - .finish() - } - } - - impl ::hash::Hash for utmpx { - fn hash(&self, state: &mut H) { - self.ut_user.hash(state); - self.ut_type.hash(state); - self.ut_pid.hash(state); - self.ut_line.hash(state); - self.ut_id.hash(state); - self.ut_host.hash(state); - self.ut_exit.hash(state); - self.ut_session.hash(state); - self.ut_tv.hash(state); - self.ut_syslen.hash(state); - self.ut_pad.hash(state); - } - } - - impl PartialEq for epoll_event { - fn eq(&self, other: &epoll_event) -> bool { - self.events == other.events - && self.u64 == other.u64 - } - } - impl Eq for epoll_event {} - impl ::fmt::Debug for epoll_event { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let events = self.events; - let u64 = self.u64; - f.debug_struct("epoll_event") - .field("events", &events) - .field("u64", &u64) - .finish() - } - } - impl ::hash::Hash for epoll_event { - fn hash(&self, state: &mut H) { - let events = self.events; - let u64 = self.u64; - events.hash(state); - u64.hash(state); - } - } - - impl PartialEq for sockaddr_un { - fn eq(&self, other: &sockaddr_un) -> bool { - self.sun_family == other.sun_family - && self - .sun_path - .iter() - .zip(other.sun_path.iter()) - .all(|(a, b)| a == b) - } - } - impl Eq for sockaddr_un {} - impl ::fmt::Debug for sockaddr_un { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_un") - .field("sun_family", &self.sun_family) - // FIXME: .field("sun_path", &self.sun_path) - .finish() - } - } - impl ::hash::Hash for sockaddr_un { - fn hash(&self, state: &mut H) { - self.sun_family.hash(state); - self.sun_path.hash(state); - } - } - - impl PartialEq for utsname { - fn eq(&self, other: &utsname) -> bool { - self.sysname - .iter() - .zip(other.sysname.iter()) - .all(|(a, b)| a == b) - && self - .nodename - .iter() - .zip(other.nodename.iter()) - .all(|(a, b)| a == b) - && self - .release - .iter() - .zip(other.release.iter()) - .all(|(a, b)| a == b) - && self - .version - .iter() - .zip(other.version.iter()) - .all(|(a, b)| a == b) - && self - .machine - .iter() - .zip(other.machine.iter()) - .all(|(a, b)| a == b) - } - } - impl Eq for utsname {} - impl ::fmt::Debug for utsname { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("utsname") - // FIXME: .field("sysname", &self.sysname) - // FIXME: .field("nodename", &self.nodename) - // FIXME: .field("release", &self.release) - // FIXME: .field("version", &self.version) - // FIXME: .field("machine", &self.machine) - .finish() - } - } - impl ::hash::Hash for utsname { - fn hash(&self, state: &mut H) { - self.sysname.hash(state); - self.nodename.hash(state); - self.release.hash(state); - self.version.hash(state); - self.machine.hash(state); - } - } - - impl PartialEq for fd_set { - fn eq(&self, other: &fd_set) -> bool { - self.fds_bits - .iter() - .zip(other.fds_bits.iter()) - .all(|(a, b)| a == b) - } - } - impl Eq for fd_set {} - impl ::fmt::Debug for fd_set { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("fd_set") - // FIXME: .field("fds_bits", &self.fds_bits) - .finish() - } - } - impl ::hash::Hash for fd_set { - fn hash(&self, state: &mut H) { - self.fds_bits.hash(state); - } - } - - impl PartialEq for sockaddr_storage { - fn eq(&self, other: &sockaddr_storage) -> bool { - self.ss_family == other.ss_family - && self.__ss_pad1 == other.__ss_pad1 - && self.__ss_align == other.__ss_align - && self - .__ss_pad2 - .iter() - .zip(other.__ss_pad2.iter()) - .all(|(a, b)| a == b) - } - } - impl Eq for sockaddr_storage {} - impl ::fmt::Debug for sockaddr_storage { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_storage") - .field("ss_family", &self.ss_family) - .field("__ss_pad1", &self.__ss_pad1) - .field("__ss_align", &self.__ss_align) - // FIXME: .field("__ss_pad2", &self.__ss_pad2) - .finish() - } - } - impl ::hash::Hash for sockaddr_storage { - fn hash(&self, state: &mut H) { - self.ss_family.hash(state); - self.__ss_pad1.hash(state); - self.__ss_align.hash(state); - self.__ss_pad2.hash(state); - } - } - - impl siginfo_t { - /// The siginfo_t will have differing contents based on the delivered signal. Based on - /// `si_signo`, this determines how many of the `c_int` pad fields contain valid data - /// exposed by the C unions. - /// - /// It is not yet exhausitive for the OS-defined types, and defaults to assuming the - /// entire data pad area is "valid" for otherwise unrecognized signal numbers. - fn data_field_count(&self) -> usize { - match self.si_signo { - ::SIGSEGV | ::SIGBUS | ::SIGILL | ::SIGTRAP | ::SIGFPE => { - ::mem::size_of::() / ::mem::size_of::<::c_int>() - } - ::SIGCLD => ::mem::size_of::() / ::mem::size_of::<::c_int>(), - ::SIGHUP - | ::SIGINT - | ::SIGQUIT - | ::SIGABRT - | ::SIGSYS - | ::SIGPIPE - | ::SIGALRM - | ::SIGTERM - | ::SIGUSR1 - | ::SIGUSR2 - | ::SIGPWR - | ::SIGWINCH - | ::SIGURG => ::mem::size_of::() / ::mem::size_of::<::c_int>(), - _ => SIGINFO_DATA_SIZE, - } - } - } - impl PartialEq for siginfo_t { - fn eq(&self, other: &siginfo_t) -> bool { - if self.si_signo == other.si_signo - && self.si_code == other.si_code - && self.si_errno == other.si_errno { - // FIXME: The `si_pad` field in the 64-bit version of the struct is ignored - // (for now) when doing comparisons. - - let field_count = self.data_field_count(); - self.__data_pad[..field_count] - .iter() - .zip(other.__data_pad[..field_count].iter()) - .all(|(a, b)| a == b) - } else { - false - } - } - } - impl Eq for siginfo_t {} - impl ::fmt::Debug for siginfo_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("siginfo_t") - .field("si_signo", &self.si_signo) - .field("si_code", &self.si_code) - .field("si_errno", &self.si_errno) - // FIXME: .field("__pad", &self.__pad) - .finish() - } - } - impl ::hash::Hash for siginfo_t { - fn hash(&self, state: &mut H) { - self.si_signo.hash(state); - self.si_code.hash(state); - self.si_errno.hash(state); - - // FIXME: The `si_pad` field in the 64-bit version of the struct is ignored - // (for now) when doing hashing. - - let field_count = self.data_field_count(); - self.__data_pad[..field_count].hash(state) - } - } - - impl PartialEq for sockaddr_dl { - fn eq(&self, other: &sockaddr_dl) -> bool { - self.sdl_family == other.sdl_family - && self.sdl_index == other.sdl_index - && self.sdl_type == other.sdl_type - && self.sdl_nlen == other.sdl_nlen - && self.sdl_alen == other.sdl_alen - && self.sdl_slen == other.sdl_slen - && self - .sdl_data - .iter() - .zip(other.sdl_data.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for sockaddr_dl {} - impl ::fmt::Debug for sockaddr_dl { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_dl") - .field("sdl_family", &self.sdl_family) - .field("sdl_index", &self.sdl_index) - .field("sdl_type", &self.sdl_type) - .field("sdl_nlen", &self.sdl_nlen) - .field("sdl_alen", &self.sdl_alen) - .field("sdl_slen", &self.sdl_slen) - // FIXME: .field("sdl_data", &self.sdl_data) - .finish() - } - } - impl ::hash::Hash for sockaddr_dl { - fn hash(&self, state: &mut H) { - self.sdl_family.hash(state); - self.sdl_index.hash(state); - self.sdl_type.hash(state); - self.sdl_nlen.hash(state); - self.sdl_alen.hash(state); - self.sdl_slen.hash(state); - self.sdl_data.hash(state); - } - } - - impl PartialEq for sigevent { - fn eq(&self, other: &sigevent) -> bool { - self.sigev_notify == other.sigev_notify - && self.sigev_signo == other.sigev_signo - && self.sigev_value == other.sigev_value - && self.ss_sp == other.ss_sp - && self.sigev_notify_attributes - == other.sigev_notify_attributes - } - } - impl Eq for sigevent {} - impl ::fmt::Debug for sigevent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sigevent") - .field("sigev_notify", &self.sigev_notify) - .field("sigev_signo", &self.sigev_signo) - .field("sigev_value", &self.sigev_value) - .field("ss_sp", &self.ss_sp) - .field("sigev_notify_attributes", - &self.sigev_notify_attributes) - .finish() - } - } - impl ::hash::Hash for sigevent { - fn hash(&self, state: &mut H) { - self.sigev_notify.hash(state); - self.sigev_signo.hash(state); - self.sigev_value.hash(state); - self.ss_sp.hash(state); - self.sigev_notify_attributes.hash(state); - } - } - - impl PartialEq for pad128_t { - fn eq(&self, other: &pad128_t) -> bool { - unsafe { - // FIXME: self._q == other._q || - self._l == other._l - } - } - } - impl Eq for pad128_t {} - impl ::fmt::Debug for pad128_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - unsafe { - f.debug_struct("pad128_t") - // FIXME: .field("_q", &{self._q}) - .field("_l", &{self._l}) - .finish() - } - } - } - impl ::hash::Hash for pad128_t { - fn hash(&self, state: &mut H) { - unsafe { - // FIXME: state.write_i64(self._q as i64); - self._l.hash(state); - } - } - } - impl PartialEq for upad128_t { - fn eq(&self, other: &upad128_t) -> bool { - unsafe { - // FIXME: self._q == other._q || - self._l == other._l - } - } - } - impl Eq for upad128_t {} - impl ::fmt::Debug for upad128_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - unsafe { - f.debug_struct("upad128_t") - // FIXME: .field("_q", &{self._q}) - .field("_l", &{self._l}) - .finish() - } - } - } - impl ::hash::Hash for upad128_t { - fn hash(&self, state: &mut H) { - unsafe { - // FIXME: state.write_i64(self._q as i64); - self._l.hash(state); - } - } - } - } -} - cfg_if! { if #[cfg(target_pointer_width = "64")] { const SIGINFO_DATA_SIZE: usize = 60; diff --git a/src/unix/solarish/solaris.rs b/src/unix/solarish/solaris.rs index 5ab67884f6a68..7afba093e83a0 100644 --- a/src/unix/solarish/solaris.rs +++ b/src/unix/solarish/solaris.rs @@ -24,22 +24,17 @@ s! { pub d_descriptor: ::c_int, pub d_id: ::door_id_t } -} -s_no_extra_traits! { - #[cfg_attr(feature = "extra_traits", allow(missing_debug_implementations))] pub union door_desc_t__d_data { pub d_desc: door_desc_t__d_data__d_desc, d_resv: [::c_int; 5], /* Check out /usr/include/sys/door.h */ } - #[cfg_attr(feature = "extra_traits", allow(missing_debug_implementations))] pub struct door_desc_t { pub d_attributes: door_attr_t, pub d_data: door_desc_t__d_data, } - #[cfg_attr(feature = "extra_traits", allow(missing_debug_implementations))] pub struct door_arg_t { pub data_ptr: *const ::c_char, pub data_size: ::size_t, diff --git a/src/unix/solarish/x86_64.rs b/src/unix/solarish/x86_64.rs index d0e80b5588c46..2e953225eee1c 100644 --- a/src/unix/solarish/x86_64.rs +++ b/src/unix/solarish/x86_64.rs @@ -47,9 +47,7 @@ s! { pub dlpi_adds: ::c_ulonglong, pub dlpi_subs: ::c_ulonglong, } -} -s_no_extra_traits! { pub union __c_anonymous_fp_reg_set { pub fpchip_state: __c_anonymous_fpchip_state, pub f_fpregs: [[u32; 13]; 10], @@ -74,86 +72,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for __c_anonymous_fp_reg_set { - fn eq(&self, other: &__c_anonymous_fp_reg_set) -> bool { - unsafe { - self.fpchip_state == other.fpchip_state || - self. - f_fpregs. - iter(). - zip(other.f_fpregs.iter()). - all(|(a, b)| a == b) - } - } - } - impl Eq for __c_anonymous_fp_reg_set {} - impl ::fmt::Debug for __c_anonymous_fp_reg_set { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - unsafe { - f.debug_struct("__c_anonymous_fp_reg_set") - .field("fpchip_state", &{self.fpchip_state}) - .field("f_fpregs", &{self.f_fpregs}) - .finish() - } - } - } - impl PartialEq for fpregset_t { - fn eq(&self, other: &fpregset_t) -> bool { - self.fp_reg_set == other.fp_reg_set - } - } - impl Eq for fpregset_t {} - impl ::fmt::Debug for fpregset_t { - fn fmt(&self, f:&mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("fpregset_t") - .field("fp_reg_set", &self.fp_reg_set) - .finish() - } - } - impl PartialEq for mcontext_t { - fn eq(&self, other: &mcontext_t) -> bool { - self.gregs == other.gregs && - self.fpregs == other.fpregs - } - } - impl Eq for mcontext_t {} - impl ::fmt::Debug for mcontext_t { - fn fmt(&self, f:&mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("mcontext_t") - .field("gregs", &self.gregs) - .field("fpregs", &self.fpregs) - .finish() - } - } - impl PartialEq for ucontext_t { - fn eq(&self, other: &ucontext_t) -> bool { - self.uc_flags == other.uc_flags - && self.uc_link == other.uc_link - && self.uc_sigmask == other.uc_sigmask - && self.uc_stack == other.uc_stack - && self.uc_mcontext == other.uc_mcontext - && self.uc_filler == other.uc_filler - } - } - impl Eq for ucontext_t {} - impl ::fmt::Debug for ucontext_t { - fn fmt(&self, f:&mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ucontext_t") - .field("uc_flags", &self.uc_flags) - .field("uc_link", &self.uc_link) - .field("uc_sigmask", &self.uc_sigmask) - .field("uc_stack", &self.uc_stack) - .field("uc_mcontext", &self.uc_mcontext) - .field("uc_filler", &self.uc_filler) - .finish() - } - } - - } -} - // sys/regset.h pub const REG_GSBASE: ::c_int = 27; diff --git a/src/vxworks/mod.rs b/src/vxworks/mod.rs index 4e23f250ba5a0..ba9ab4272420f 100644 --- a/src/vxworks/mod.rs +++ b/src/vxworks/mod.rs @@ -3,7 +3,6 @@ use core::mem::size_of; use core::ptr::null_mut; -#[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum DIR {} impl ::Copy for DIR {} impl ::Clone for DIR { @@ -103,7 +102,6 @@ pub type sa_family_t = ::c_uchar; // mqueue.h pub type mqd_t = ::c_int; -#[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum _Vx_semaphore {} impl ::Copy for _Vx_semaphore {} impl ::Clone for _Vx_semaphore { @@ -411,9 +409,7 @@ s! { pub mq_flags: ::c_long, pub mq_curmsgs: ::c_long, } -} -s_no_extra_traits! { // dirent.h pub struct dirent { pub d_ino : ::ino_t, @@ -460,117 +456,6 @@ s_no_extra_traits! { } } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl ::fmt::Debug for dirent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("dirent") - .field("d_ino", &self.d_ino) - .field("d_name", &&self.d_name[..]) - .finish() - } - } - - impl ::fmt::Debug for sockaddr_un { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_un") - .field("sun_len", &self.sun_len) - .field("sun_family", &self.sun_family) - .field("sun_path", &&self.sun_path[..]) - .finish() - } - } - - impl ::fmt::Debug for RTP_DESC { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("RTP_DESC") - .field("status", &self.status) - .field("options", &self.options) - .field("entrAddr", &self.entrAddr) - .field("initTaskId", &self.initTaskId) - .field("parentId", &self.parentId) - .field("pathName", &&self.pathName[..]) - .field("taskCnt", &self.taskCnt) - .field("textStart", &self.textStart) - .field("textEnd", &self.textEnd) - .finish() - } - } - impl ::fmt::Debug for sockaddr_storage { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_storage") - .field("ss_len", &self.ss_len) - .field("ss_family", &self.ss_family) - .field("__ss_pad1", &&self.__ss_pad1[..]) - .field("__ss_align", &self.__ss_align) - .field("__ss_pad2", &&self.__ss_pad2[..]) - .finish() - } - } - - impl PartialEq for sa_u_t { - fn eq(&self, other: &sa_u_t) -> bool { - unsafe { - let h1 = match self.sa_handler { - Some(handler) => handler as usize, - None => 0 as usize, - }; - let h2 = match other.sa_handler { - Some(handler) => handler as usize, - None => 0 as usize, - }; - h1 == h2 - } - } - } - impl Eq for sa_u_t {} - impl ::fmt::Debug for sa_u_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - unsafe { - let h = match self.sa_handler { - Some(handler) => handler as usize, - None => 0 as usize, - }; - - f.debug_struct("sa_u_t") - .field("sa_handler", &h) - .finish() - } - } - } - impl ::hash::Hash for sa_u_t { - fn hash(&self, state: &mut H) { - unsafe { - let h = match self.sa_handler { - Some(handler) => handler as usize, - None => 0 as usize, - }; - h.hash(state) - } - } - } - - impl PartialEq for sigval { - fn eq(&self, other: &sigval) -> bool { - unsafe { self.sival_ptr as usize == other.sival_ptr as usize } - } - } - impl Eq for sigval {} - impl ::fmt::Debug for sigval { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sigval") - .field("sival_ptr", unsafe { &(self.sival_ptr as usize) }) - .finish() - } - } - impl ::hash::Hash for sigval { - fn hash(&self, state: &mut H) { - unsafe { (self.sival_ptr as usize).hash(state) }; - } - } - } -} - pub const STDIN_FILENO: ::c_int = 0; pub const STDOUT_FILENO: ::c_int = 1; pub const STDERR_FILENO: ::c_int = 2; @@ -1033,7 +918,6 @@ pub const MAP_CONTIG: ::c_int = 0x0020; pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void; -#[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum FILE {} impl ::Copy for FILE {} impl ::Clone for FILE { @@ -1041,7 +925,6 @@ impl ::Clone for FILE { *self } } -#[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum fpos_t {} // FIXME: fill this out with a struct impl ::Copy for fpos_t {} impl ::Clone for fpos_t { diff --git a/src/wasi.rs b/src/wasi.rs index 87e1e72891840..a47bc743de032 100644 --- a/src/wasi.rs +++ b/src/wasi.rs @@ -41,22 +41,18 @@ pub type wchar_t = i32; pub type nl_item = c_int; pub type __wasi_rights_t = u64; -s_no_extra_traits! { +s! { #[repr(align(16))] - #[allow(missing_debug_implementations)] pub struct max_align_t { priv_: [f64; 4] } } #[allow(missing_copy_implementations)] -#[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum FILE {} #[allow(missing_copy_implementations)] -#[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum DIR {} #[allow(missing_copy_implementations)] -#[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum __locale_struct {} pub type locale_t = *mut __locale_struct; @@ -181,7 +177,6 @@ s! { // etc., since it contains a flexible array member with a dynamic size. #[repr(C)] #[allow(missing_copy_implementations)] -#[cfg_attr(feature = "extra_traits", derive(Debug))] pub struct dirent { pub d_ino: ino_t, pub d_type: c_uchar, diff --git a/src/windows/gnu/align.rs b/src/windows/gnu/align.rs index 3af99e3ca149b..d519b181beb91 100644 --- a/src/windows/gnu/align.rs +++ b/src/windows/gnu/align.rs @@ -1,15 +1,13 @@ cfg_if! { if #[cfg(target_pointer_width = "64")] { - s_no_extra_traits! { - #[allow(missing_debug_implementations)] + s! { #[repr(align(16))] pub struct max_align_t { priv_: [f64; 4] } } } else if #[cfg(target_pointer_width = "32")] { - s_no_extra_traits! { - #[allow(missing_debug_implementations)] + s! { #[repr(align(16))] pub struct max_align_t { priv_: [i64; 6] diff --git a/src/windows/mod.rs b/src/windows/mod.rs index 8fcdfbede0866..a0218706f7aa4 100644 --- a/src/windows/mod.rs +++ b/src/windows/mod.rs @@ -40,7 +40,6 @@ cfg_if! { pub type off_t = i32; pub type dev_t = u32; pub type ino_t = u16; -#[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum timezone {} impl ::Copy for timezone {} impl ::Clone for timezone { @@ -254,7 +253,6 @@ pub const SIG_GET: ::sighandler_t = 2; pub const SIG_SGE: ::sighandler_t = 3; pub const SIG_ACK: ::sighandler_t = 4; -#[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum FILE {} impl ::Copy for FILE {} impl ::Clone for FILE { @@ -262,7 +260,6 @@ impl ::Clone for FILE { *self } } -#[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum fpos_t {} // FIXME: fill this out with a struct impl ::Copy for fpos_t {} impl ::Clone for fpos_t { From 3a4e2e4b790d67c8be3f3a17434cd2920c73f8a2 Mon Sep 17 00:00:00 2001 From: Ryan Johnson Date: Fri, 10 May 2024 12:26:51 +0000 Subject: [PATCH 2/3] Fix style check --- ci/style.rs | 7 +--- src/unix/linux_like/linux/mod.rs | 66 +++++++++++++++++--------------- src/wasi.rs | 12 +++--- 3 files changed, 42 insertions(+), 43 deletions(-) diff --git a/ci/style.rs b/ci/style.rs index 8665259e7faa5..42b35131fd8e8 100644 --- a/ci/style.rs +++ b/ci/style.rs @@ -97,7 +97,6 @@ enum State { fn check_style(file: &str, path: &Path, err: &mut Errors) { let mut state = State::Start; - let mut s_macros = 0; let mut f_macros = 0; let mut in_impl = false; @@ -140,7 +139,7 @@ fn check_style(file: &str, path: &Path, err: &mut Errors) { } else if line.starts_with("type ") && !in_impl { State::Typedefs } else if line.starts_with("s! {") { - s_macros += 1; + // multiple macros of this type are allowed State::Structs } else if line.starts_with("s_paren! {") { // multiple macros of this type are allowed @@ -172,10 +171,6 @@ fn check_style(file: &str, path: &Path, err: &mut Errors) { f_macros += 1; err.error(path, i, "multiple f! macros in one module"); } - if s_macros == 2 { - s_macros += 1; - err.error(path, i, "multiple s! macros in one module"); - } state = line_state; } diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index 74eb36b4e6ccf..d7403b923204b 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -789,11 +789,11 @@ s! { pub port: ::c_uchar, } - pub struct in6_ifreq { - pub ifr6_addr: ::in6_addr, - pub ifr6_prefixlen: u32, - pub ifr6_ifindex: ::c_int, - } + pub struct in6_ifreq { + pub ifr6_addr: ::in6_addr, + pub ifr6_prefixlen: u32, + pub ifr6_ifindex: ::c_int, + } pub struct option { pub name: *const ::c_char, @@ -903,23 +903,27 @@ s! { pub disabled: __u8, pub flags: __u16, } + pub struct iw_point { pub pointer: *mut ::c_void, pub length: __u16, pub flags: __u16, } + pub struct iw_freq { pub m: __s32, pub e: __s16, pub i: __u8, pub flags: __u8, } + pub struct iw_quality { pub qual: __u8, pub level: __u8, pub noise: __u8, pub updated: __u8, } + pub struct iw_discarded { pub nwid: __u32, pub code: __u32, @@ -927,9 +931,11 @@ s! { pub retries: __u32, pubmisc: __u32, } + pub struct iw_missed { pub beacon: __u32, } + pub struct iw_scan_req { pub scan_type: __u8, pub essid_len: __u8, @@ -941,6 +947,7 @@ s! { pub max_channel_time: __u32, pub channel_list: [iw_freq; IW_MAX_FREQUENCIES], } + pub struct iw_encode_ext { pub ext_flags: __u32, pub tx_seq: [__u8; IW_ENCODE_SEQ_MAX_SIZE], @@ -950,22 +957,26 @@ s! { pub key_len: __u16, pub key: [__u8;0], } + pub struct iw_pmksa { pub cmd: __u32, pub bssid: ::sockaddr, pub pmkid: [__u8; IW_PMKID_LEN], } + pub struct iw_pmkid_cand { pub flags: __u32, pub index: __u32, pub bssid: ::sockaddr, } + pub struct iw_statistics { pub status: __u16, pub qual: iw_quality, pub discard: iw_discarded, pub miss: iw_missed, } + pub struct iw_range { pub throughput: __u32, pub min_nwid: __u32, @@ -1011,6 +1022,7 @@ s! { pub freq: [iw_freq; IW_MAX_FREQUENCIES], pub enc_capa: __u32, } + pub struct iw_priv_args { pub cmd: __u32, pub set_args: __u16, @@ -1021,7 +1033,7 @@ s! { cfg_if! { if #[cfg(not(target_arch = "sparc64"))] { - s!{ + s! { pub struct iw_thrspy { pub addr: ::sockaddr, pub qual: iw_quality, @@ -1195,17 +1207,13 @@ s! { pub offset_to_priv: ::__u32, pub hdr: ::tpacket_bd_header_u, } -} -s! { // linux/net_tstamp.h pub struct sock_txtime { pub clockid: ::clockid_t, pub flags: ::__u32, } -} -s! { // linux/can.h pub union __c_anonymous_sockaddr_can_can_addr { pub tp: __c_anonymous_sockaddr_can_tp, @@ -1217,29 +1225,27 @@ s! { pub can_ifindex: ::c_int, pub can_addr: __c_anonymous_sockaddr_can_can_addr, } -} -s! { // linux/wireless.h pub union iwreq_data { - pub name: [c_char; ::IFNAMSIZ], - pub essid: iw_point, - pub nwid: iw_param, - pub freq: iw_freq, - pub sens: iw_param, - pub bitrate: iw_param, - pub txpower: iw_param, - pub rts: iw_param, - pub frag: iw_param, - pub mode: __u32, - pub retry: iw_param, - pub encoding: iw_point, - pub power: iw_param, - pub qual: iw_quality, - pub ap_addr: ::sockaddr, - pub addr: ::sockaddr, - pub param: iw_param, - pub data: iw_point, + pub name: [c_char; ::IFNAMSIZ], + pub essid: iw_point, + pub nwid: iw_param, + pub freq: iw_freq, + pub sens: iw_param, + pub bitrate: iw_param, + pub txpower: iw_param, + pub rts: iw_param, + pub frag: iw_param, + pub mode: __u32, + pub retry: iw_param, + pub encoding: iw_point, + pub power: iw_param, + pub qual: iw_quality, + pub ap_addr: ::sockaddr, + pub addr: ::sockaddr, + pub param: iw_param, + pub data: iw_point, } pub struct iw_event { diff --git a/src/wasi.rs b/src/wasi.rs index a47bc743de032..0c0b5286abbf4 100644 --- a/src/wasi.rs +++ b/src/wasi.rs @@ -41,13 +41,6 @@ pub type wchar_t = i32; pub type nl_item = c_int; pub type __wasi_rights_t = u64; -s! { - #[repr(align(16))] - pub struct max_align_t { - priv_: [f64; 4] - } -} - #[allow(missing_copy_implementations)] pub enum FILE {} #[allow(missing_copy_implementations)] @@ -69,6 +62,11 @@ unsafe impl Send for clockid_t {} unsafe impl Sync for clockid_t {} s! { + #[repr(align(16))] + pub struct max_align_t { + priv_: [f64; 4] + } + #[repr(align(8))] pub struct fpos_t { data: [u8; 16], From b88d7b6276301ab455c403cd91b6475892b05188 Mon Sep 17 00:00:00 2001 From: Ryan Johnson Date: Fri, 10 May 2024 13:06:16 +0000 Subject: [PATCH 3/3] Restore `#[allow(deprecated)]` on generated `s!` types --- src/macros.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/macros.rs b/src/macros.rs index 527c1f9bf7665..ca00d2443ff79 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -67,6 +67,7 @@ macro_rules! s { )*); (it: $(#[$attr:meta])* pub union $i:ident { $($field:tt)* }) => ( __item! { + #[allow(deprecated)] #[repr(C)] $(#[$attr])* pub union $i { $($field)* } @@ -79,6 +80,7 @@ macro_rules! s { ); (it: $(#[$attr:meta])* pub struct $i:ident { $($field:tt)* }) => ( __item! { + #[allow(deprecated)] #[repr(C)] $(#[$attr])* pub struct $i { $($field)* }