]> git.proxmox.com Git - rustc.git/blame - library/std/src/os/raw/mod.rs
New upstream version 1.48.0~beta.8+dfsg1
[rustc.git] / library / std / src / os / raw / mod.rs
CommitLineData
2c00a5a8
XL
1//! Platform-specific types, as defined by C.
2//!
3//! Code that interacts via FFI will almost certainly be using the
4//! base types provided by C, which aren't nearly as nicely defined
5//! as Rust's primitive types. This module provides types which will
6//! match those defined by C, so that code that interacts with C will
7//! refer to the correct types.
d9579d0f
AL
8
9#![stable(feature = "raw_os", since = "1.1.0")]
10
1b1a35ee
XL
11#[cfg(test)]
12mod tests;
13
e1599b0c 14#[doc(include = "char.md")]
60c5eb7d
XL
15#[cfg(any(
16 all(
17 target_os = "linux",
18 any(
19 target_arch = "aarch64",
20 target_arch = "arm",
21 target_arch = "hexagon",
22 target_arch = "powerpc",
23 target_arch = "powerpc64",
dfeec247 24 target_arch = "s390x",
1b1a35ee
XL
25 target_arch = "riscv64",
26 target_arch = "riscv32"
60c5eb7d
XL
27 )
28 ),
29 all(target_os = "android", any(target_arch = "aarch64", target_arch = "arm")),
30 all(target_os = "l4re", target_arch = "x86_64"),
31 all(
32 target_os = "freebsd",
33 any(
34 target_arch = "aarch64",
35 target_arch = "arm",
36 target_arch = "powerpc",
37 target_arch = "powerpc64"
38 )
39 ),
40 all(
41 target_os = "netbsd",
42 any(target_arch = "aarch64", target_arch = "arm", target_arch = "powerpc")
43 ),
44 all(target_os = "openbsd", target_arch = "aarch64"),
45 all(
46 target_os = "vxworks",
47 any(
48 target_arch = "aarch64",
49 target_arch = "arm",
50 target_arch = "powerpc64",
51 target_arch = "powerpc"
52 )
53 ),
54 all(target_os = "fuchsia", target_arch = "aarch64")
55))]
56#[stable(feature = "raw_os", since = "1.1.0")]
57pub type c_char = u8;
e1599b0c 58#[doc(include = "char.md")]
60c5eb7d
XL
59#[cfg(not(any(
60 all(
61 target_os = "linux",
62 any(
63 target_arch = "aarch64",
64 target_arch = "arm",
65 target_arch = "hexagon",
66 target_arch = "powerpc",
67 target_arch = "powerpc64",
dfeec247 68 target_arch = "s390x",
1b1a35ee
XL
69 target_arch = "riscv64",
70 target_arch = "riscv32"
60c5eb7d
XL
71 )
72 ),
73 all(target_os = "android", any(target_arch = "aarch64", target_arch = "arm")),
74 all(target_os = "l4re", target_arch = "x86_64"),
75 all(
76 target_os = "freebsd",
77 any(
78 target_arch = "aarch64",
79 target_arch = "arm",
80 target_arch = "powerpc",
81 target_arch = "powerpc64"
82 )
83 ),
84 all(
85 target_os = "netbsd",
86 any(target_arch = "aarch64", target_arch = "arm", target_arch = "powerpc")
87 ),
88 all(target_os = "openbsd", target_arch = "aarch64"),
89 all(
90 target_os = "vxworks",
91 any(
92 target_arch = "aarch64",
93 target_arch = "arm",
94 target_arch = "powerpc64",
95 target_arch = "powerpc"
96 )
97 ),
98 all(target_os = "fuchsia", target_arch = "aarch64")
99)))]
100#[stable(feature = "raw_os", since = "1.1.0")]
101pub type c_char = i8;
e1599b0c 102#[doc(include = "schar.md")]
60c5eb7d
XL
103#[stable(feature = "raw_os", since = "1.1.0")]
104pub type c_schar = i8;
e1599b0c 105#[doc(include = "uchar.md")]
60c5eb7d
XL
106#[stable(feature = "raw_os", since = "1.1.0")]
107pub type c_uchar = u8;
e1599b0c 108#[doc(include = "short.md")]
60c5eb7d
XL
109#[stable(feature = "raw_os", since = "1.1.0")]
110pub type c_short = i16;
e1599b0c 111#[doc(include = "ushort.md")]
60c5eb7d
XL
112#[stable(feature = "raw_os", since = "1.1.0")]
113pub type c_ushort = u16;
e1599b0c 114#[doc(include = "int.md")]
60c5eb7d
XL
115#[stable(feature = "raw_os", since = "1.1.0")]
116pub type c_int = i32;
e1599b0c 117#[doc(include = "uint.md")]
60c5eb7d
XL
118#[stable(feature = "raw_os", since = "1.1.0")]
119pub type c_uint = u32;
e1599b0c 120#[doc(include = "long.md")]
d9579d0f 121#[cfg(any(target_pointer_width = "32", windows))]
60c5eb7d
XL
122#[stable(feature = "raw_os", since = "1.1.0")]
123pub type c_long = i32;
e1599b0c 124#[doc(include = "ulong.md")]
d9579d0f 125#[cfg(any(target_pointer_width = "32", windows))]
60c5eb7d
XL
126#[stable(feature = "raw_os", since = "1.1.0")]
127pub type c_ulong = u32;
e1599b0c 128#[doc(include = "long.md")]
d9579d0f 129#[cfg(all(target_pointer_width = "64", not(windows)))]
60c5eb7d
XL
130#[stable(feature = "raw_os", since = "1.1.0")]
131pub type c_long = i64;
e1599b0c 132#[doc(include = "ulong.md")]
d9579d0f 133#[cfg(all(target_pointer_width = "64", not(windows)))]
60c5eb7d
XL
134#[stable(feature = "raw_os", since = "1.1.0")]
135pub type c_ulong = u64;
e1599b0c 136#[doc(include = "longlong.md")]
60c5eb7d
XL
137#[stable(feature = "raw_os", since = "1.1.0")]
138pub type c_longlong = i64;
e1599b0c 139#[doc(include = "ulonglong.md")]
60c5eb7d
XL
140#[stable(feature = "raw_os", since = "1.1.0")]
141pub type c_ulonglong = u64;
e1599b0c 142#[doc(include = "float.md")]
60c5eb7d
XL
143#[stable(feature = "raw_os", since = "1.1.0")]
144pub type c_float = f32;
e1599b0c 145#[doc(include = "double.md")]
60c5eb7d
XL
146#[stable(feature = "raw_os", since = "1.1.0")]
147pub type c_double = f64;
d9579d0f 148
d9579d0f 149#[stable(feature = "raw_os", since = "1.1.0")]
b7449926
XL
150#[doc(no_inline)]
151pub use core::ffi::c_void;