summaryrefslogtreecommitdiffstats
path: root/library/std/src/os/raw/mod.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /library/std/src/os/raw/mod.rs
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'library/std/src/os/raw/mod.rs')
-rw-r--r--library/std/src/os/raw/mod.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/library/std/src/os/raw/mod.rs b/library/std/src/os/raw/mod.rs
new file mode 100644
index 000000000..19d0ffb2e
--- /dev/null
+++ b/library/std/src/os/raw/mod.rs
@@ -0,0 +1,31 @@
+//! Compatibility module for C platform-specific types. Use [`core::ffi`] instead.
+
+#![stable(feature = "raw_os", since = "1.1.0")]
+
+#[cfg(test)]
+mod tests;
+
+macro_rules! alias_core_ffi {
+ ($($t:ident)*) => {$(
+ #[stable(feature = "raw_os", since = "1.1.0")]
+ #[doc = include_str!(concat!("../../../../core/src/ffi/", stringify!($t), ".md"))]
+ // Make this type alias appear cfg-dependent so that Clippy does not suggest
+ // replacing expressions like `0 as c_char` with `0_i8`/`0_u8`. This #[cfg(all())] can be
+ // removed after the false positive in https://github.com/rust-lang/rust-clippy/issues/8093
+ // is fixed.
+ #[cfg(all())]
+ #[doc(cfg(all()))]
+ pub type $t = core::ffi::$t;
+ )*}
+}
+
+alias_core_ffi! {
+ c_char c_schar c_uchar
+ c_short c_ushort
+ c_int c_uint
+ c_long c_ulong
+ c_longlong c_ulonglong
+ c_float
+ c_double
+ c_void
+}