File tree Expand file tree Collapse file tree 16 files changed +61
-222
lines changed Expand file tree Collapse file tree 16 files changed +61
-222
lines changed Original file line number Diff line number Diff line change @@ -78,32 +78,10 @@ pub type fsblkcnt_t = c_ulonglong;
7878pub type fsfilcnt_t = c_ulonglong ;
7979pub type rlim_t = c_ulonglong ;
8080
81- // FIXME(fuchsia): why are these uninhabited types? that seems... wrong?
82- // Presumably these should be `()` or an `extern type` (when that stabilizes).
83- #[ derive( Debug ) ]
84- pub enum timezone { }
85- impl Copy for timezone { }
86- impl Clone for timezone {
87- fn clone ( & self ) -> timezone {
88- * self
89- }
90- }
91- #[ derive( Debug ) ]
92- pub enum DIR { }
93- impl Copy for DIR { }
94- impl Clone for DIR {
95- fn clone ( & self ) -> DIR {
96- * self
97- }
98- }
99-
100- #[ derive( Debug ) ]
101- pub enum fpos64_t { } // FIXME(fuchsia): fill this out with a struct
102- impl Copy for fpos64_t { }
103- impl Clone for fpos64_t {
104- fn clone ( & self ) -> fpos64_t {
105- * self
106- }
81+ extern_ty ! {
82+ pub enum timezone { }
83+ pub enum DIR { }
84+ pub enum fpos64_t { } // FIXME(fuchsia): fill this out with a struct
10785}
10886
10987// PUB_STRUCT
@@ -3421,21 +3399,9 @@ fn __MHDR_END(mhdr: *const msghdr) -> *mut c_uchar {
34213399#[ link( name = "fdio" ) ]
34223400extern "C" { }
34233401
3424- #[ derive( Debug ) ]
3425- pub enum FILE { }
3426- impl Copy for FILE { }
3427- impl Clone for FILE {
3428- fn clone ( & self ) -> FILE {
3429- * self
3430- }
3431- }
3432- #[ derive( Debug ) ]
3433- pub enum fpos_t { } // FIXME(fuchsia): fill this out with a struct
3434- impl Copy for fpos_t { }
3435- impl Clone for fpos_t {
3436- fn clone ( & self ) -> fpos_t {
3437- * self
3438- }
3402+ extern_ty ! {
3403+ pub enum FILE { }
3404+ pub enum fpos_t { } // FIXME(fuchsia): fill this out with a struct
34393405}
34403406
34413407extern "C" {
Original file line number Diff line number Diff line change @@ -203,8 +203,9 @@ macro_rules! s_no_extra_traits {
203203 ) ;
204204}
205205
206- /// Create an uninhabited type that can't be constructed. It implements `Debug` but no
207- /// other traits.
206+ /// Create an uninhabited type that can't be constructed. It implements `Debug`, `Clone`,
207+ /// and `Copy`, but these aren't meaningful for extern types so they should eventually
208+ /// be removed.
208209///
209210/// Really what we want here is something that also can't be named without indirection (in
210211/// ADTs or function signatures), but this doesn't exist.
@@ -214,9 +215,13 @@ macro_rules! extern_ty {
214215 pub enum $i: ident { }
215216 ) * ) => ( $(
216217 $( #[ $attr] ) *
217- #[ allow( missing_copy_implementations) ]
218- // FIXME(1.0): the type is uninhabited so this trait is unreachable.
219- #[ :: core:: prelude:: v1:: derive( :: core:: fmt:: Debug ) ]
218+ // FIXME(1.0): the type is uninhabited so these traits are unreachable and could be
219+ // removed.
220+ #[ :: core:: prelude:: v1:: derive(
221+ :: core:: clone:: Clone ,
222+ :: core:: marker:: Copy ,
223+ :: core:: fmt:: Debug ,
224+ ) ]
220225 pub enum $i { }
221226 ) * ) ;
222227}
Original file line number Diff line number Diff line change @@ -395,21 +395,9 @@ pub const SIGUSR1: c_int = 30;
395395pub const SIGUSR2 : c_int = 31 ;
396396pub const SIGPWR : c_int = 32 ;
397397
398- #[ derive( Debug ) ]
399- pub enum FILE { }
400- impl Copy for FILE { }
401- impl Clone for FILE {
402- fn clone ( & self ) -> FILE {
403- * self
404- }
405- }
406- #[ derive( Debug ) ]
407- pub enum fpos_t { }
408- impl Copy for fpos_t { }
409- impl Clone for fpos_t {
410- fn clone ( & self ) -> fpos_t {
411- * self
412- }
398+ extern_ty ! {
399+ pub enum FILE { }
400+ pub enum fpos_t { }
413401}
414402
415403extern "C" {
Original file line number Diff line number Diff line change @@ -179,13 +179,8 @@ deprecated_mach! {
179179 pub type mach_timebase_info_data_t = mach_timebase_info;
180180}
181181
182- #[ derive( Debug ) ]
183- pub enum timezone { }
184- impl Copy for timezone { }
185- impl Clone for timezone {
186- fn clone ( & self ) -> timezone {
187- * self
188- }
182+ extern_ty ! {
183+ pub enum timezone { }
189184}
190185
191186#[ derive( Debug ) ]
Original file line number Diff line number Diff line change @@ -45,13 +45,8 @@ pub type vm_map_entry_t = *mut vm_map_entry;
4545
4646pub type pmap = __c_anonymous_pmap ;
4747
48- #[ derive( Debug ) ]
49- pub enum sem { }
50- impl Copy for sem { }
51- impl Clone for sem {
52- fn clone ( & self ) -> sem {
53- * self
54- }
48+ extern_ty ! {
49+ pub enum sem { }
5550}
5651
5752e ! {
Original file line number Diff line number Diff line change @@ -59,13 +59,8 @@ cfg_if! {
5959
6060// link.h
6161
62- #[ derive( Debug ) ]
63- pub enum timezone { }
64- impl Copy for timezone { }
65- impl Clone for timezone {
66- fn clone ( & self ) -> timezone {
67- * self
68- }
62+ extern_ty ! {
63+ pub enum timezone { }
6964}
7065
7166impl siginfo_t {
Original file line number Diff line number Diff line change @@ -16,21 +16,9 @@ pub type id_t = u32;
1616pub type sem_t = * mut sem ;
1717pub type key_t = c_long ;
1818
19- #[ derive( Debug ) ]
20- pub enum timezone { }
21- impl Copy for timezone { }
22- impl Clone for timezone {
23- fn clone ( & self ) -> timezone {
24- * self
25- }
26- }
27- #[ derive( Debug ) ]
28- pub enum sem { }
29- impl Copy for sem { }
30- impl Clone for sem {
31- fn clone ( & self ) -> sem {
32- * self
33- }
19+ extern_ty ! {
20+ pub enum timezone { }
21+ pub enum sem { }
3422}
3523
3624s ! {
Original file line number Diff line number Diff line change @@ -28,13 +28,8 @@ pub type nlink_t = c_ushort;
2828pub type suseconds_t = c_long ;
2929pub type useconds_t = c_ulong ;
3030
31- #[ derive( Debug ) ]
32- pub enum timezone { }
33- impl Copy for timezone { }
34- impl Clone for timezone {
35- fn clone ( & self ) -> timezone {
36- * self
37- }
31+ extern_ty ! {
32+ pub enum timezone { }
3833}
3934
4035pub type sigset_t = c_ulong ;
@@ -75,13 +70,8 @@ pub type nfds_t = c_uint;
7570
7671pub type sem_t = * mut sem ;
7772
78- #[ derive( Debug ) ]
79- pub enum sem { }
80- impl Copy for sem { }
81- impl Clone for sem {
82- fn clone ( & self ) -> sem {
83- * self
84- }
73+ extern_ty ! {
74+ pub enum sem { }
8575}
8676
8777pub type tcflag_t = c_uint ;
Original file line number Diff line number Diff line change @@ -80,13 +80,8 @@ pub type ACTION = c_int;
8080pub type posix_spawnattr_t = * mut c_void ;
8181pub type posix_spawn_file_actions_t = * mut c_void ;
8282
83- #[ derive( Debug ) ]
84- pub enum timezone { }
85- impl Copy for timezone { }
86- impl Clone for timezone {
87- fn clone ( & self ) -> timezone {
88- * self
89- }
83+ extern_ty ! {
84+ pub enum timezone { }
9085}
9186
9287impl siginfo_t {
Original file line number Diff line number Diff line change @@ -225,22 +225,9 @@ pub type nl_item = c_int;
225225
226226pub type iconv_t = * mut c_void ;
227227
228- #[ derive( Debug ) ]
229- pub enum fpos64_t { } // FIXME(hurd): fill this out with a struct
230- impl Copy for fpos64_t { }
231- impl Clone for fpos64_t {
232- fn clone ( & self ) -> fpos64_t {
233- * self
234- }
235- }
236-
237- #[ derive( Debug ) ]
238- pub enum timezone { }
239- impl Copy for timezone { }
240- impl Clone for timezone {
241- fn clone ( & self ) -> timezone {
242- * self
243- }
228+ extern_ty ! {
229+ pub enum fpos64_t { } // FIXME(hurd): fill this out with a struct
230+ pub enum timezone { }
244231}
245232
246233// structs
You can’t perform that action at this time.
0 commit comments