Skip to content

Commit

Permalink
Check for Debug impls for all types
Browse files Browse the repository at this point in the history
This was not compile-tested on all platforms, but instead all `pub enum`
types had a `Debug` impl derived for them.
  • Loading branch information
Susurrus committed Feb 2, 2019
1 parent 81a4950 commit d5dded9
Show file tree
Hide file tree
Showing 17 changed files with 36 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/cloudabi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ pub const PTHREAD_STACK_MIN: ::size_t = 1024;
pub const SOCK_DGRAM: ::c_int = 128;
pub const SOCK_STREAM: ::c_int = 130;

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum FILE {}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum fpos_t {} // TODO: fill this out with a struct

extern {
Expand Down
6 changes: 6 additions & 0 deletions src/fuchsia/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,13 @@ 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 {}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum DIR {}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum locale_t {}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum fpos64_t {} // TODO: fill this out with a struct

// PUB_STRUCT
Expand Down Expand Up @@ -3042,7 +3046,9 @@ f! {
#[link(name = "fdio")]
extern {}

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum FILE {}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum fpos_t {} // TODO: fill this out with a struct

extern {
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@
#![cfg_attr(feature = "rustc-dep-of-std", no_core)]
#![cfg_attr(feature = "rustc-dep-of-std", allow(warnings))]
#![cfg_attr(not(any(feature = "use_std", feature = "rustc-dep-of-std")), no_std)]
// Enable lints
#![cfg_attr(feature = "extra_traits", deny(missing_debug_implementations))]

#[cfg(all(not(cross_platform_docs), feature = "use_std"))]
extern crate std as core;
Expand Down
2 changes: 2 additions & 0 deletions src/redox/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,9 @@ pub const SIGIO: ::c_int = 29;
pub const SIGPWR: ::c_int = 30;
pub const SIGSYS: ::c_int = 31;

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum FILE {}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum fpos_t {} // TODO: fill this out with a struct

// intentionally not public, only used for fd_set
Expand Down
1 change: 1 addition & 0 deletions src/unix/bsd/apple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub type posix_spawn_file_actions_t = *mut ::c_void;
pub type key_t = ::c_int;
pub type shmatt_t = ::c_ushort;

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum timezone {}

s! {
Expand Down
1 change: 1 addition & 0 deletions src/unix/bsd/freebsdlike/dragonfly/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub type fsfilcnt_t = u64;

pub type sem_t = *mut sem;

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum sem {}

s! {
Expand Down
1 change: 1 addition & 0 deletions src/unix/bsd/freebsdlike/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub type speed_t = ::c_uint;
pub type nl_item = ::c_int;
pub type id_t = i64;

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum timezone {}

s! {
Expand Down
2 changes: 2 additions & 0 deletions src/unix/bsd/netbsdlike/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ pub type clockid_t = ::c_int;
pub type id_t = ::uint32_t;
pub type sem_t = *mut sem;

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum timezone {}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum sem {}

s! {
Expand Down
1 change: 1 addition & 0 deletions src/unix/haiku/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub type nl_item = ::c_int;
pub type id_t = i32;
pub type idtype_t = ::c_uint;

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum timezone {}

s! {
Expand Down
4 changes: 4 additions & 0 deletions src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ pub type in_port_t = u16;
pub type sighandler_t = ::size_t;
pub type cc_t = ::c_uchar;

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum DIR {}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum locale_t {}

s! {
Expand Down Expand Up @@ -365,7 +367,9 @@ cfg_if! {
}
}

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum FILE {}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum fpos_t {} // TODO: fill this out with a struct

extern {
Expand Down
8 changes: 4 additions & 4 deletions src/unix/notbsd/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ impl std::fmt::Debug for dirent {
.field("d_off", &self.d_off)
.field("d_reclen", &self.d_reclen)
.field("d_type", &self.d_type)
.field("d_name", &self.d_name)
// FIXME: .field("d_name", &self.d_name)
.finish()
}
}
Expand Down Expand Up @@ -302,7 +302,7 @@ impl std::fmt::Debug for dirent64 {
.field("d_off", &self.d_off)
.field("d_reclen", &self.d_reclen)
.field("d_type", &self.d_type)
.field("d_name", &self.d_name)
// FIXME: .field("d_name", &self.d_name)
.finish()
}
}
Expand Down Expand Up @@ -374,7 +374,7 @@ impl std::fmt::Debug for lastlog {
f.debug_struct("lastlog")
.field("ll_time", &self.ll_time)
.field("ll_line", &self.ll_line)
.field("ll_host", &self.ll_host)
// FIXME: .field("ll_host", &self.ll_host)
.finish()
}
}
Expand Down Expand Up @@ -425,7 +425,7 @@ impl std::fmt::Debug for utmp {
.field("ut_line", &self.ut_line)
.field("ut_id", &self.ut_id)
.field("ut_user", &self.ut_user)
.field("ut_host", &self.ut_host)
// 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)
Expand Down
1 change: 1 addition & 0 deletions src/unix/notbsd/emscripten.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pub type c_long = i32;
pub type c_ulong = u32;
pub type nlink_t = u32;

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum fpos64_t {} // TODO: fill this out with a struct

s! {
Expand Down
1 change: 1 addition & 0 deletions src/unix/notbsd/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ pub type Elf64_Sxword = i64;
pub type Elf32_Section = u16;
pub type Elf64_Section = u16;

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum fpos64_t {} // TODO: fill this out with a struct

s! {
Expand Down
1 change: 1 addition & 0 deletions src/unix/notbsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pub type clockid_t = ::c_int;
pub type key_t = ::c_int;
pub type id_t = ::c_uint;

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum timezone {}

s! {
Expand Down
1 change: 1 addition & 0 deletions src/unix/solaris/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pub type nl_item = ::c_int;
pub type id_t = ::c_int;
pub type idtype_t = ::c_uint;

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum timezone {}

s! {
Expand Down
2 changes: 2 additions & 0 deletions src/unix/uclibc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ pub type nfds_t = ::c_ulong;
pub type nl_item = ::c_int;
pub type idtype_t = ::c_uint;

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum fpos64_t {} // TODO: fill this out with a struct

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum timezone {}

s! {
Expand Down
5 changes: 4 additions & 1 deletion src/windows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ 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 {}
pub type time64_t = i64;

Expand Down Expand Up @@ -201,7 +202,9 @@ pub const SIG_ERR: ::c_int = -1;
#[link(name = "libcmt", cfg(target_feature = "crt-static"))]
extern {}

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum FILE {}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum fpos_t {} // TODO: fill this out with a struct

extern {
Expand Down Expand Up @@ -446,4 +449,4 @@ cfg_if! {
} else {
// Unknown target_env
}
}
}

0 comments on commit d5dded9

Please sign in to comment.