File tree Expand file tree Collapse file tree 5 files changed +14
-15
lines changed Expand file tree Collapse file tree 5 files changed +14
-15
lines changed Original file line number Diff line number Diff line change @@ -203,15 +203,20 @@ macro_rules! s_no_extra_traits {
203203 ) ;
204204}
205205
206- /// Specify that an enum should have no traits that aren't specified in the macro
207- /// invocation, i.e. no `Clone` or `Copy`.
208- macro_rules! missing {
206+ /// Create an uninhabited type that can't be constructed. It implements `Debug` but no
207+ /// other traits.
208+ ///
209+ /// Really what we want here is something that also can't be named without indirection (in
210+ /// ADTs or function signatures), but this doesn't exist.
211+ macro_rules! extern_ty {
209212 ( $(
210213 $( #[ $attr: meta] ) *
211214 pub enum $i: ident { }
212215 ) * ) => ( $(
213216 $( #[ $attr] ) *
214217 #[ 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 ) ]
215220 pub enum $i { }
216221 ) * ) ;
217222}
Original file line number Diff line number Diff line change @@ -2,8 +2,7 @@ use crate::off_t;
22use crate :: prelude:: * ;
33
44// Define lock_data_instrumented as an empty enum
5- missing ! {
6- #[ derive( Debug ) ]
5+ extern_ty ! {
76 pub enum lock_data_instrumented { }
87}
98
Original file line number Diff line number Diff line change @@ -67,8 +67,7 @@ pub type eventfd_t = u64;
6767
6868cfg_if ! {
6969 if #[ cfg( not( target_env = "gnu" ) ) ] {
70- missing! {
71- #[ derive( Debug ) ]
70+ extern_ty! {
7271 pub enum fpos64_t { } // FIXME(linux): fill this out with a struct
7372 }
7473 }
Original file line number Diff line number Diff line change @@ -8,8 +8,7 @@ pub type timer_t = *mut c_void;
88pub type key_t = c_int ;
99pub type id_t = c_uint ;
1010
11- missing ! {
12- #[ derive( Debug ) ]
11+ extern_ty ! {
1312 pub enum timezone { }
1413}
1514
Original file line number Diff line number Diff line change @@ -37,8 +37,7 @@ cfg_if! {
3737 }
3838}
3939
40- missing ! {
41- #[ derive( Debug ) ]
40+ extern_ty ! {
4241 pub enum DIR { }
4342}
4443pub type locale_t = * mut c_void ;
@@ -585,15 +584,13 @@ cfg_if! {
585584
586585cfg_if ! {
587586 if #[ cfg( not( all( target_os = "linux" , target_env = "gnu" ) ) ) ] {
588- missing! {
589- #[ derive( Debug ) ]
587+ extern_ty! {
590588 pub enum fpos_t { } // FIXME(unix): fill this out with a struct
591589 }
592590 }
593591}
594592
595- missing ! {
596- #[ derive( Debug ) ]
593+ extern_ty ! {
597594 pub enum FILE { }
598595}
599596
You can’t perform that action at this time.
0 commit comments