@@ -19,7 +19,7 @@ pub use self::c_str::{CStr, FromBytesUntilNulError, FromBytesWithNulError};
19
19
20
20
mod c_str;
21
21
22
- macro_rules! type_alias_no_nz {
22
+ macro_rules! type_alias {
23
23
{
24
24
$Docfile: tt, $Alias: ident = $Real: ty;
25
25
$( $Cfg: tt ) *
@@ -31,49 +31,24 @@ macro_rules! type_alias_no_nz {
31
31
}
32
32
}
33
33
34
- // To verify that the NonZero types in this file's macro invocations correspond
35
- //
36
- // perl -n < library/std/src/os/raw/mod.rs -e 'next unless m/type_alias\!/; die "$_ ?" unless m/, (c_\w+) = (\w+), NonZero_(\w+) = NonZero(\w+)/; die "$_ ?" unless $3 eq $1 and $4 eq ucfirst $2'
37
- //
38
- // NB this does not check that the main c_* types are right.
39
-
40
- macro_rules! type_alias {
41
- {
42
- $Docfile: tt, $Alias: ident = $Real: ty, $NZAlias: ident = $NZReal: ty;
43
- $( $Cfg: tt ) *
44
- } => {
45
- type_alias_no_nz! { $Docfile, $Alias = $Real; $( $Cfg ) * }
46
-
47
- #[ doc = concat!( "Type alias for `NonZero` version of [`" , stringify!( $Alias) , "`]" ) ]
48
- #[ unstable( feature = "raw_os_nonzero" , issue = "82363" ) ]
49
- $( $Cfg ) *
50
- pub type $NZAlias = $NZReal;
51
- }
52
- }
53
-
54
- type_alias ! { "c_char.md" , c_char = c_char_definition:: c_char, NonZero_c_char = c_char_definition:: NonZero_c_char ;
55
- #[ doc( cfg( all( ) ) ) ] }
34
+ type_alias ! { "c_char.md" , c_char = c_char_definition:: c_char; #[ doc( cfg( all( ) ) ) ] }
56
35
57
- type_alias ! { "c_schar.md" , c_schar = i8 , NonZero_c_schar = NonZeroI8 ; }
58
- type_alias ! { "c_uchar.md" , c_uchar = u8 , NonZero_c_uchar = NonZeroU8 ; }
59
- type_alias ! { "c_short.md" , c_short = i16 , NonZero_c_short = NonZeroI16 ; }
60
- type_alias ! { "c_ushort.md" , c_ushort = u16 , NonZero_c_ushort = NonZeroU16 ; }
36
+ type_alias ! { "c_schar.md" , c_schar = i8 ; }
37
+ type_alias ! { "c_uchar.md" , c_uchar = u8 ; }
38
+ type_alias ! { "c_short.md" , c_short = i16 ; }
39
+ type_alias ! { "c_ushort.md" , c_ushort = u16 ; }
61
40
62
- type_alias ! { "c_int.md" , c_int = c_int_definition:: c_int, NonZero_c_int = c_int_definition:: NonZero_c_int ;
63
- #[ doc( cfg( all( ) ) ) ] }
64
- type_alias ! { "c_uint.md" , c_uint = c_int_definition:: c_uint, NonZero_c_uint = c_int_definition:: NonZero_c_uint ;
65
- #[ doc( cfg( all( ) ) ) ] }
41
+ type_alias ! { "c_int.md" , c_int = c_int_definition:: c_int; #[ doc( cfg( all( ) ) ) ] }
42
+ type_alias ! { "c_uint.md" , c_uint = c_int_definition:: c_uint; #[ doc( cfg( all( ) ) ) ] }
66
43
67
- type_alias ! { "c_long.md" , c_long = c_long_definition:: c_long, NonZero_c_long = c_long_definition:: NonZero_c_long ;
68
- #[ doc( cfg( all( ) ) ) ] }
69
- type_alias ! { "c_ulong.md" , c_ulong = c_long_definition:: c_ulong, NonZero_c_ulong = c_long_definition:: NonZero_c_ulong ;
70
- #[ doc( cfg( all( ) ) ) ] }
44
+ type_alias ! { "c_long.md" , c_long = c_long_definition:: c_long; #[ doc( cfg( all( ) ) ) ] }
45
+ type_alias ! { "c_ulong.md" , c_ulong = c_long_definition:: c_ulong; #[ doc( cfg( all( ) ) ) ] }
71
46
72
- type_alias ! { "c_longlong.md" , c_longlong = i64 , NonZero_c_longlong = NonZeroI64 ; }
73
- type_alias ! { "c_ulonglong.md" , c_ulonglong = u64 , NonZero_c_ulonglong = NonZeroU64 ; }
47
+ type_alias ! { "c_longlong.md" , c_longlong = i64 ; }
48
+ type_alias ! { "c_ulonglong.md" , c_ulonglong = u64 ; }
74
49
75
- type_alias_no_nz ! { "c_float.md" , c_float = f32 ; }
76
- type_alias_no_nz ! { "c_double.md" , c_double = f64 ; }
50
+ type_alias ! { "c_float.md" , c_float = f32 ; }
51
+ type_alias ! { "c_double.md" , c_double = f64 ; }
77
52
78
53
/// Equivalent to C's `size_t` type, from `stddef.h` (or `cstddef` for C++).
79
54
///
@@ -152,11 +127,9 @@ mod c_char_definition {
152
127
target_os = "horizon"
153
128
) ) ] {
154
129
pub type c_char = u8 ;
155
- pub type NonZero_c_char = crate :: num:: NonZeroU8 ;
156
130
} else {
157
131
// On every other target, c_char is signed.
158
132
pub type c_char = i8 ;
159
- pub type NonZero_c_char = crate :: num:: NonZeroI8 ;
160
133
}
161
134
}
162
135
}
@@ -165,14 +138,10 @@ mod c_int_definition {
165
138
cfg_if ! {
166
139
if #[ cfg( any( target_arch = "avr" , target_arch = "msp430" ) ) ] {
167
140
pub type c_int = i16 ;
168
- pub type NonZero_c_int = crate :: num:: NonZeroI16 ;
169
141
pub type c_uint = u16 ;
170
- pub type NonZero_c_uint = crate :: num:: NonZeroU16 ;
171
142
} else {
172
143
pub type c_int = i32 ;
173
- pub type NonZero_c_int = crate :: num:: NonZeroI32 ;
174
144
pub type c_uint = u32 ;
175
- pub type NonZero_c_uint = crate :: num:: NonZeroU32 ;
176
145
}
177
146
}
178
147
}
@@ -181,15 +150,11 @@ mod c_long_definition {
181
150
cfg_if ! {
182
151
if #[ cfg( all( target_pointer_width = "64" , not( windows) ) ) ] {
183
152
pub type c_long = i64 ;
184
- pub type NonZero_c_long = crate :: num:: NonZeroI64 ;
185
153
pub type c_ulong = u64 ;
186
- pub type NonZero_c_ulong = crate :: num:: NonZeroU64 ;
187
154
} else {
188
155
// The minimal size of `long` in the C standard is 32 bits
189
156
pub type c_long = i32 ;
190
- pub type NonZero_c_long = crate :: num:: NonZeroI32 ;
191
157
pub type c_ulong = u32 ;
192
- pub type NonZero_c_ulong = crate :: num:: NonZeroU32 ;
193
158
}
194
159
}
195
160
}
0 commit comments