Skip to content

Commit eb5bdf7

Browse files
committed
Re-export core::ffi integer types rather than redefining
Since the MSRV was raised to 1.65, we can use these aliases directly rather than copying them. In a future version, we can consider deprecation.
1 parent 82b7480 commit eb5bdf7

File tree

1 file changed

+17
-58
lines changed

1 file changed

+17
-58
lines changed

src/primitives.rs

Lines changed: 17 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -6,64 +6,6 @@
66
//!
77
//! The fixed-width integer aliases are deprecated: use the Rust types instead.
88
9-
pub type c_schar = i8;
10-
pub type c_uchar = u8;
11-
pub type c_short = i16;
12-
pub type c_ushort = u16;
13-
14-
pub type c_longlong = i64;
15-
pub type c_ulonglong = u64;
16-
17-
pub type c_float = f32;
18-
pub type c_double = f64;
19-
20-
cfg_if! {
21-
if #[cfg(all(
22-
not(windows),
23-
not(target_vendor = "apple"),
24-
not(target_os = "vita"),
25-
any(
26-
target_arch = "aarch64",
27-
target_arch = "arm",
28-
target_arch = "csky",
29-
target_arch = "hexagon",
30-
target_arch = "msp430",
31-
target_arch = "powerpc",
32-
target_arch = "powerpc64",
33-
target_arch = "riscv32",
34-
target_arch = "riscv64",
35-
target_arch = "s390x",
36-
target_arch = "xtensa",
37-
)
38-
))] {
39-
pub type c_char = u8;
40-
} else {
41-
// On every other target, c_char is signed.
42-
pub type c_char = i8;
43-
}
44-
}
45-
46-
cfg_if! {
47-
if #[cfg(any(target_arch = "avr", target_arch = "msp430"))] {
48-
pub type c_int = i16;
49-
pub type c_uint = u16;
50-
} else {
51-
pub type c_int = i32;
52-
pub type c_uint = u32;
53-
}
54-
}
55-
56-
cfg_if! {
57-
if #[cfg(all(target_pointer_width = "64", not(windows)))] {
58-
pub type c_long = i64;
59-
pub type c_ulong = u64;
60-
} else {
61-
// The minimal size of `long` in the C standard is 32 bits
62-
pub type c_long = i32;
63-
pub type c_ulong = u32;
64-
}
65-
}
66-
679
#[deprecated(since = "0.2.55", note = "Use i8 instead.")]
6810
pub type int8_t = i8;
6911
#[deprecated(since = "0.2.55", note = "Use i16 instead.")]
@@ -81,6 +23,23 @@ pub type uint32_t = u32;
8123
#[deprecated(since = "0.2.55", note = "Use u64 instead.")]
8224
pub type uint64_t = u64;
8325

26+
// FIXME(1.0): Deprecate these aliases in a few releases, remove in 1.0.
27+
pub use core::ffi::{
28+
c_char,
29+
c_double,
30+
c_float,
31+
c_int,
32+
c_long,
33+
c_longlong,
34+
c_schar,
35+
c_short,
36+
c_uchar,
37+
c_uint,
38+
c_ulong,
39+
c_ulonglong,
40+
c_ushort,
41+
};
42+
8443
cfg_if! {
8544
if #[cfg(all(
8645
target_arch = "aarch64",

0 commit comments

Comments
 (0)