Skip to content

Commit fa9cb78

Browse files
committed
Check for Debug impls for all types
This was not compile-tested on all platforms, but instead all `pub enum` types had a `Debug` impl derived for them.
1 parent cd1e16d commit fa9cb78

File tree

17 files changed

+36
-5
lines changed

17 files changed

+36
-5
lines changed

src/cloudabi/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ pub const PTHREAD_STACK_MIN: ::size_t = 1024;
122122
pub const SOCK_DGRAM: ::c_int = 128;
123123
pub const SOCK_STREAM: ::c_int = 130;
124124

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

128130
extern {

src/fuchsia/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,13 @@ pub type c_ulong = u64;
100100

101101
// FIXME: why are these uninhabited types? that seems... wrong?
102102
// Presumably these should be `()` or an `extern type` (when that stabilizes).
103+
#[cfg_attr(feature = "extra_traits", derive(Debug))]
103104
pub enum timezone {}
105+
#[cfg_attr(feature = "extra_traits", derive(Debug))]
104106
pub enum DIR {}
107+
#[cfg_attr(feature = "extra_traits", derive(Debug))]
105108
pub enum locale_t {}
109+
#[cfg_attr(feature = "extra_traits", derive(Debug))]
106110
pub enum fpos64_t {} // TODO: fill this out with a struct
107111

108112
// PUB_STRUCT
@@ -3042,7 +3046,9 @@ f! {
30423046
#[link(name = "fdio")]
30433047
extern {}
30443048

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

30483054
extern {

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@
156156
#![cfg_attr(feature = "rustc-dep-of-std", no_core)]
157157
#![cfg_attr(feature = "rustc-dep-of-std", allow(warnings))]
158158
#![cfg_attr(not(any(feature = "use_std", feature = "rustc-dep-of-std")), no_std)]
159+
// Enable lints
160+
#![cfg_attr(feature = "extra_traits", deny(missing_debug_implementations))]
159161

160162
#[cfg(all(not(cross_platform_docs), feature = "use_std"))]
161163
extern crate std as core;

src/redox/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,9 @@ pub const SIGIO: ::c_int = 29;
219219
pub const SIGPWR: ::c_int = 30;
220220
pub const SIGSYS: ::c_int = 31;
221221

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

225227
// intentionally not public, only used for fd_set

src/unix/bsd/apple/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ pub type posix_spawn_file_actions_t = *mut ::c_void;
3434
pub type key_t = ::c_int;
3535
pub type shmatt_t = ::c_ushort;
3636

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

3940
s! {

src/unix/bsd/freebsdlike/dragonfly/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub type fsfilcnt_t = u64;
1717

1818
pub type sem_t = *mut sem;
1919

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

2223
s! {

src/unix/bsd/freebsdlike/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pub type speed_t = ::c_uint;
1616
pub type nl_item = ::c_int;
1717
pub type id_t = i64;
1818

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

2122
s! {

src/unix/bsd/netbsdlike/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ pub type clockid_t = ::c_int;
1313
pub type id_t = ::uint32_t;
1414
pub type sem_t = *mut sem;
1515

16+
#[cfg_attr(feature = "extra_traits", derive(Debug))]
1617
pub enum timezone {}
18+
#[cfg_attr(feature = "extra_traits", derive(Debug))]
1719
pub enum sem {}
1820

1921
s! {

src/unix/haiku/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pub type nl_item = ::c_int;
3131
pub type id_t = i32;
3232
pub type idtype_t = ::c_uint;
3333

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

3637
s! {

src/unix/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ pub type in_port_t = u16;
4141
pub type sighandler_t = ::size_t;
4242
pub type cc_t = ::c_uchar;
4343

44+
#[cfg_attr(feature = "extra_traits", derive(Debug))]
4445
pub enum DIR {}
46+
#[cfg_attr(feature = "extra_traits", derive(Debug))]
4547
pub enum locale_t {}
4648

4749
s! {
@@ -365,7 +367,9 @@ cfg_if! {
365367
}
366368
}
367369

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

371375
extern {

src/unix/notbsd/android/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ impl std::fmt::Debug for dirent {
264264
.field("d_off", &self.d_off)
265265
.field("d_reclen", &self.d_reclen)
266266
.field("d_type", &self.d_type)
267-
.field("d_name", &self.d_name)
267+
// FIXME: .field("d_name", &self.d_name)
268268
.finish()
269269
}
270270
}
@@ -302,7 +302,7 @@ impl std::fmt::Debug for dirent64 {
302302
.field("d_off", &self.d_off)
303303
.field("d_reclen", &self.d_reclen)
304304
.field("d_type", &self.d_type)
305-
.field("d_name", &self.d_name)
305+
// FIXME: .field("d_name", &self.d_name)
306306
.finish()
307307
}
308308
}
@@ -374,7 +374,7 @@ impl std::fmt::Debug for lastlog {
374374
f.debug_struct("lastlog")
375375
.field("ll_time", &self.ll_time)
376376
.field("ll_line", &self.ll_line)
377-
.field("ll_host", &self.ll_host)
377+
// FIXME: .field("ll_host", &self.ll_host)
378378
.finish()
379379
}
380380
}
@@ -425,7 +425,7 @@ impl std::fmt::Debug for utmp {
425425
.field("ut_line", &self.ut_line)
426426
.field("ut_id", &self.ut_id)
427427
.field("ut_user", &self.ut_user)
428-
.field("ut_host", &self.ut_host)
428+
// FIXME: .field("ut_host", &self.ut_host)
429429
.field("ut_exit", &self.ut_exit)
430430
.field("ut_session", &self.ut_session)
431431
.field("ut_tv", &self.ut_tv)

src/unix/notbsd/emscripten.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ pub type c_long = i32;
3535
pub type c_ulong = u32;
3636
pub type nlink_t = u32;
3737

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

4041
s! {

src/unix/notbsd/linux/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ pub type Elf64_Sxword = i64;
3838
pub type Elf32_Section = u16;
3939
pub type Elf64_Section = u16;
4040

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

4344
s! {

src/unix/notbsd/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ pub type clockid_t = ::c_int;
88
pub type key_t = ::c_int;
99
pub type id_t = ::c_uint;
1010

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

1314
s! {

src/unix/solaris/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ pub type nl_item = ::c_int;
3636
pub type id_t = ::c_int;
3737
pub type idtype_t = ::c_uint;
3838

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

4142
s! {

src/unix/uclibc/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ pub type nfds_t = ::c_ulong;
2424
pub type nl_item = ::c_int;
2525
pub type idtype_t = ::c_uint;
2626

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

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

3133
s! {

src/windows/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ cfg_if! {
4747
pub type off_t = i32;
4848
pub type dev_t = u32;
4949
pub type ino_t = u16;
50+
#[cfg_attr(feature = "extra_traits", derive(Debug))]
5051
pub enum timezone {}
5152
pub type time64_t = i64;
5253

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

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

207210
extern {
@@ -446,4 +449,4 @@ cfg_if! {
446449
} else {
447450
// Unknown target_env
448451
}
449-
}
452+
}

0 commit comments

Comments
 (0)