summaryrefslogtreecommitdiff
path: root/src/libstd/os/raw
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-07-27 17:39:01 +0000
committerbors <bors@rust-lang.org>2020-07-27 17:39:01 +0000
commit54e000891ffccd4cbfb92146b92736c83085df63 (patch)
tree1200bb13eb9ae22def4c43bc657bc56da8faedc6 /src/libstd/os/raw
parent4a90e36c85336d1d4b209556c1a9733210bbff19 (diff)
parent6d9705220fec4553d693a7c19d99496e14c89edf (diff)
downloadrust-tmp-nightly.tar.gz
Auto merge of #73265 - mark-i-m:mv-std, r=<try>tmp-nightly
mv std libs to library/ This is the first step in refactoring the directory layout of this repository, with further followup steps planned (but not done yet). Background: currently, all crates are under src/, without nested src directories and with the unconventional `lib*` prefixes (e.g., `src/libcore/lib.rs`). This directory structures is not idiomatic and makes the `src/` directory rather overwhelming. To improve contributor experience and make things a bit more approachable, we are reorganizing the repo a bit. In this PR, we move the standard libs (basically anything that is "runtime", as opposed to part of the compiler, build system, or one of the tools, etc). The new layout moves these libraries to a new `library/` directory in the root of the repo. Additionally, we remove the `lib*` prefixes and add nested `src/` directories. The other crates/tools in this repo are not touched. So in summary: ``` library/<crate>/src/*.rs src/<all the rest> // unchanged ``` where `<crate>` is: - core - alloc - std - test - proc_macro - panic_abort - panic_unwind - profiler_builtins - term - unwind - rtstartup - backtrace - rustc-std-workspace-* There was a lot of discussion about this and a few rounds of compiler team approvals, FCPs, MCPs, and nominations. The original MCP is https://github.com/rust-lang/compiler-team/issues/298. The final approval of the compiler team was given here: https://github.com/rust-lang/rust/pull/73265#issuecomment-659498446. The name `library` was chosen to complement a later move of the compiler crates to a `compiler/` directory. There was a lot of discussion around adding the nested `src/` directories. Note that this does increase the nesting depth (plausibly important for manual traversal of the tree, e.g., through GitHub's UI or `cd`), but this is deemed to be better as it fits the standard layout of Rust crates throughout most of the ecosystem, though there is some debate about how much this should apply to multi-crate projects. Overall, there seem to be more people in favor of nested `src/` than against. After this PR, there are no dependencies out of the `library/` directory except on the `build_helper` (or crates.io crates).
Diffstat (limited to 'src/libstd/os/raw')
-rw-r--r--src/libstd/os/raw/char.md11
-rw-r--r--src/libstd/os/raw/double.md7
-rw-r--r--src/libstd/os/raw/float.md6
-rw-r--r--src/libstd/os/raw/int.md7
-rw-r--r--src/libstd/os/raw/long.md7
-rw-r--r--src/libstd/os/raw/longlong.md7
-rw-r--r--src/libstd/os/raw/mod.rs167
-rw-r--r--src/libstd/os/raw/schar.md6
-rw-r--r--src/libstd/os/raw/short.md6
-rw-r--r--src/libstd/os/raw/uchar.md6
-rw-r--r--src/libstd/os/raw/uint.md7
-rw-r--r--src/libstd/os/raw/ulong.md7
-rw-r--r--src/libstd/os/raw/ulonglong.md7
-rw-r--r--src/libstd/os/raw/ushort.md6
14 files changed, 0 insertions, 257 deletions
diff --git a/src/libstd/os/raw/char.md b/src/libstd/os/raw/char.md
deleted file mode 100644
index 9a55767d965..00000000000
--- a/src/libstd/os/raw/char.md
+++ /dev/null
@@ -1,11 +0,0 @@
-Equivalent to C's `char` type.
-
-[C's `char` type] is completely unlike [Rust's `char` type]; while Rust's type represents a unicode scalar value, C's `char` type is just an ordinary integer. This type will always be either [`i8`] or [`u8`], as the type is defined as being one byte long.
-
-C chars are most commonly used to make C strings. Unlike Rust, where the length of a string is included alongside the string, C strings mark the end of a string with the character `'\0'`. See [`CStr`] for more information.
-
-[C's `char` type]: https://en.wikipedia.org/wiki/C_data_types#Basic_types
-[Rust's `char` type]: ../../primitive.char.html
-[`CStr`]: ../../ffi/struct.CStr.html
-[`i8`]: ../../primitive.i8.html
-[`u8`]: ../../primitive.u8.html
diff --git a/src/libstd/os/raw/double.md b/src/libstd/os/raw/double.md
deleted file mode 100644
index 6818dada317..00000000000
--- a/src/libstd/os/raw/double.md
+++ /dev/null
@@ -1,7 +0,0 @@
-Equivalent to C's `double` type.
-
-This type will almost always be [`f64`], which is guaranteed to be an [IEEE-754 double-precision float] in Rust. That said, the standard technically only guarantees that it be a floating-point number with at least the precision of a [`float`], and it may be `f32` or something entirely different from the IEEE-754 standard.
-
-[IEEE-754 double-precision float]: https://en.wikipedia.org/wiki/IEEE_754
-[`float`]: type.c_float.html
-[`f64`]: ../../primitive.f64.html
diff --git a/src/libstd/os/raw/float.md b/src/libstd/os/raw/float.md
deleted file mode 100644
index 57d1071d0da..00000000000
--- a/src/libstd/os/raw/float.md
+++ /dev/null
@@ -1,6 +0,0 @@
-Equivalent to C's `float` type.
-
-This type will almost always be [`f32`], which is guaranteed to be an [IEEE-754 single-precision float] in Rust. That said, the standard technically only guarantees that it be a floating-point number, and it may have less precision than `f32` or not follow the IEEE-754 standard at all.
-
-[IEEE-754 single-precision float]: https://en.wikipedia.org/wiki/IEEE_754
-[`f32`]: ../../primitive.f32.html
diff --git a/src/libstd/os/raw/int.md b/src/libstd/os/raw/int.md
deleted file mode 100644
index a0d25fd21d8..00000000000
--- a/src/libstd/os/raw/int.md
+++ /dev/null
@@ -1,7 +0,0 @@
-Equivalent to C's `signed int` (`int`) type.
-
-This type will almost always be [`i32`], but may differ on some esoteric systems. The C standard technically only requires that this type be a signed integer that is at least the size of a [`short`]; some systems define it as an [`i16`], for example.
-
-[`short`]: type.c_short.html
-[`i32`]: ../../primitive.i32.html
-[`i16`]: ../../primitive.i16.html
diff --git a/src/libstd/os/raw/long.md b/src/libstd/os/raw/long.md
deleted file mode 100644
index c620b402819..00000000000
--- a/src/libstd/os/raw/long.md
+++ /dev/null
@@ -1,7 +0,0 @@
-Equivalent to C's `signed long` (`long`) type.
-
-This type will always be [`i32`] or [`i64`]. Most notably, many Linux-based systems assume an `i64`, but Windows assumes `i32`. The C standard technically only requires that this type be a signed integer that is at least 32 bits and at least the size of an [`int`], although in practice, no system would have a `long` that is neither an `i32` nor `i64`.
-
-[`int`]: type.c_int.html
-[`i32`]: ../../primitive.i32.html
-[`i64`]: ../../primitive.i64.html
diff --git a/src/libstd/os/raw/longlong.md b/src/libstd/os/raw/longlong.md
deleted file mode 100644
index ab3d6436568..00000000000
--- a/src/libstd/os/raw/longlong.md
+++ /dev/null
@@ -1,7 +0,0 @@
-Equivalent to C's `signed long long` (`long long`) type.
-
-This type will almost always be [`i64`], but may differ on some systems. The C standard technically only requires that this type be a signed integer that is at least 64 bits and at least the size of a [`long`], although in practice, no system would have a `long long` that is not an `i64`, as most systems do not have a standardised [`i128`] type.
-
-[`long`]: type.c_int.html
-[`i64`]: ../../primitive.i64.html
-[`i128`]: ../../primitive.i128.html
diff --git a/src/libstd/os/raw/mod.rs b/src/libstd/os/raw/mod.rs
deleted file mode 100644
index 47daf0cce1b..00000000000
--- a/src/libstd/os/raw/mod.rs
+++ /dev/null
@@ -1,167 +0,0 @@
-//! Platform-specific types, as defined by C.
-//!
-//! Code that interacts via FFI will almost certainly be using the
-//! base types provided by C, which aren't nearly as nicely defined
-//! as Rust's primitive types. This module provides types which will
-//! match those defined by C, so that code that interacts with C will
-//! refer to the correct types.
-
-#![stable(feature = "raw_os", since = "1.1.0")]
-
-#[doc(include = "char.md")]
-#[cfg(any(
- all(
- target_os = "linux",
- any(
- target_arch = "aarch64",
- target_arch = "arm",
- target_arch = "hexagon",
- target_arch = "powerpc",
- target_arch = "powerpc64",
- target_arch = "s390x",
- target_arch = "riscv64"
- )
- ),
- all(target_os = "android", any(target_arch = "aarch64", target_arch = "arm")),
- all(target_os = "l4re", target_arch = "x86_64"),
- all(
- target_os = "freebsd",
- any(
- target_arch = "aarch64",
- target_arch = "arm",
- target_arch = "powerpc",
- target_arch = "powerpc64"
- )
- ),
- all(
- target_os = "netbsd",
- any(target_arch = "aarch64", target_arch = "arm", target_arch = "powerpc")
- ),
- all(target_os = "openbsd", target_arch = "aarch64"),
- all(
- target_os = "vxworks",
- any(
- target_arch = "aarch64",
- target_arch = "arm",
- target_arch = "powerpc64",
- target_arch = "powerpc"
- )
- ),
- all(target_os = "fuchsia", target_arch = "aarch64")
-))]
-#[stable(feature = "raw_os", since = "1.1.0")]
-pub type c_char = u8;
-#[doc(include = "char.md")]
-#[cfg(not(any(
- all(
- target_os = "linux",
- any(
- target_arch = "aarch64",
- target_arch = "arm",
- target_arch = "hexagon",
- target_arch = "powerpc",
- target_arch = "powerpc64",
- target_arch = "s390x",
- target_arch = "riscv64"
- )
- ),
- all(target_os = "android", any(target_arch = "aarch64", target_arch = "arm")),
- all(target_os = "l4re", target_arch = "x86_64"),
- all(
- target_os = "freebsd",
- any(
- target_arch = "aarch64",
- target_arch = "arm",
- target_arch = "powerpc",
- target_arch = "powerpc64"
- )
- ),
- all(
- target_os = "netbsd",
- any(target_arch = "aarch64", target_arch = "arm", target_arch = "powerpc")
- ),
- all(target_os = "openbsd", target_arch = "aarch64"),
- all(
- target_os = "vxworks",
- any(
- target_arch = "aarch64",
- target_arch = "arm",
- target_arch = "powerpc64",
- target_arch = "powerpc"
- )
- ),
- all(target_os = "fuchsia", target_arch = "aarch64")
-)))]
-#[stable(feature = "raw_os", since = "1.1.0")]
-pub type c_char = i8;
-#[doc(include = "schar.md")]
-#[stable(feature = "raw_os", since = "1.1.0")]
-pub type c_schar = i8;
-#[doc(include = "uchar.md")]
-#[stable(feature = "raw_os", since = "1.1.0")]
-pub type c_uchar = u8;
-#[doc(include = "short.md")]
-#[stable(feature = "raw_os", since = "1.1.0")]
-pub type c_short = i16;
-#[doc(include = "ushort.md")]
-#[stable(feature = "raw_os", since = "1.1.0")]
-pub type c_ushort = u16;
-#[doc(include = "int.md")]
-#[stable(feature = "raw_os", since = "1.1.0")]
-pub type c_int = i32;
-#[doc(include = "uint.md")]
-#[stable(feature = "raw_os", since = "1.1.0")]
-pub type c_uint = u32;
-#[doc(include = "long.md")]
-#[cfg(any(target_pointer_width = "32", windows))]
-#[stable(feature = "raw_os", since = "1.1.0")]
-pub type c_long = i32;
-#[doc(include = "ulong.md")]
-#[cfg(any(target_pointer_width = "32", windows))]
-#[stable(feature = "raw_os", since = "1.1.0")]
-pub type c_ulong = u32;
-#[doc(include = "long.md")]
-#[cfg(all(target_pointer_width = "64", not(windows)))]
-#[stable(feature = "raw_os", since = "1.1.0")]
-pub type c_long = i64;
-#[doc(include = "ulong.md")]
-#[cfg(all(target_pointer_width = "64", not(windows)))]
-#[stable(feature = "raw_os", since = "1.1.0")]
-pub type c_ulong = u64;
-#[doc(include = "longlong.md")]
-#[stable(feature = "raw_os", since = "1.1.0")]
-pub type c_longlong = i64;
-#[doc(include = "ulonglong.md")]
-#[stable(feature = "raw_os", since = "1.1.0")]
-pub type c_ulonglong = u64;
-#[doc(include = "float.md")]
-#[stable(feature = "raw_os", since = "1.1.0")]
-pub type c_float = f32;
-#[doc(include = "double.md")]
-#[stable(feature = "raw_os", since = "1.1.0")]
-pub type c_double = f64;
-
-#[stable(feature = "raw_os", since = "1.1.0")]
-#[doc(no_inline)]
-pub use core::ffi::c_void;
-
-#[cfg(test)]
-#[allow(unused_imports)]
-mod tests {
- use crate::any::TypeId;
- use crate::mem;
-
- macro_rules! ok {
- ($($t:ident)*) => {$(
- assert!(TypeId::of::<libc::$t>() == TypeId::of::<raw::$t>(),
- "{} is wrong", stringify!($t));
- )*}
- }
-
- #[test]
- fn same() {
- use crate::os::raw;
- ok!(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);
- }
-}
diff --git a/src/libstd/os/raw/schar.md b/src/libstd/os/raw/schar.md
deleted file mode 100644
index 6aa8b1211d8..00000000000
--- a/src/libstd/os/raw/schar.md
+++ /dev/null
@@ -1,6 +0,0 @@
-Equivalent to C's `signed char` type.
-
-This type will always be [`i8`], but is included for completeness. It is defined as being a signed integer the same size as a C [`char`].
-
-[`char`]: type.c_char.html
-[`i8`]: ../../primitive.i8.html
diff --git a/src/libstd/os/raw/short.md b/src/libstd/os/raw/short.md
deleted file mode 100644
index be92c6c106d..00000000000
--- a/src/libstd/os/raw/short.md
+++ /dev/null
@@ -1,6 +0,0 @@
-Equivalent to C's `signed short` (`short`) type.
-
-This type will almost always be [`i16`], but may differ on some esoteric systems. The C standard technically only requires that this type be a signed integer with at least 16 bits; some systems may define it as `i32`, for example.
-
-[`char`]: type.c_char.html
-[`i16`]: ../../primitive.i16.html
diff --git a/src/libstd/os/raw/uchar.md b/src/libstd/os/raw/uchar.md
deleted file mode 100644
index b6ca711f869..00000000000
--- a/src/libstd/os/raw/uchar.md
+++ /dev/null
@@ -1,6 +0,0 @@
-Equivalent to C's `unsigned char` type.
-
-This type will always be [`u8`], but is included for completeness. It is defined as being an unsigned integer the same size as a C [`char`].
-
-[`char`]: type.c_char.html
-[`u8`]: ../../primitive.u8.html
diff --git a/src/libstd/os/raw/uint.md b/src/libstd/os/raw/uint.md
deleted file mode 100644
index 6f7013a8ac1..00000000000
--- a/src/libstd/os/raw/uint.md
+++ /dev/null
@@ -1,7 +0,0 @@
-Equivalent to C's `unsigned int` type.
-
-This type will almost always be [`u32`], but may differ on some esoteric systems. The C standard technically only requires that this type be an unsigned integer with the same size as an [`int`]; some systems define it as a [`u16`], for example.
-
-[`int`]: type.c_int.html
-[`u32`]: ../../primitive.u32.html
-[`u16`]: ../../primitive.u16.html
diff --git a/src/libstd/os/raw/ulong.md b/src/libstd/os/raw/ulong.md
deleted file mode 100644
index c350395080e..00000000000
--- a/src/libstd/os/raw/ulong.md
+++ /dev/null
@@ -1,7 +0,0 @@
-Equivalent to C's `unsigned long` type.
-
-This type will always be [`u32`] or [`u64`]. Most notably, many Linux-based systems assume an `u64`, but Windows assumes `u32`. The C standard technically only requires that this type be an unsigned integer with the size of a [`long`], although in practice, no system would have a `ulong` that is neither a `u32` nor `u64`.
-
-[`long`]: type.c_long.html
-[`u32`]: ../../primitive.u32.html
-[`u64`]: ../../primitive.u64.html
diff --git a/src/libstd/os/raw/ulonglong.md b/src/libstd/os/raw/ulonglong.md
deleted file mode 100644
index c41faf74c5c..00000000000
--- a/src/libstd/os/raw/ulonglong.md
+++ /dev/null
@@ -1,7 +0,0 @@
-Equivalent to C's `unsigned long long` type.
-
-This type will almost always be [`u64`], but may differ on some systems. The C standard technically only requires that this type be an unsigned integer with the size of a [`long long`], although in practice, no system would have a `long long` that is not a `u64`, as most systems do not have a standardised [`u128`] type.
-
-[`long long`]: type.c_longlong.html
-[`u64`]: ../../primitive.u64.html
-[`u128`]: ../../primitive.u128.html
diff --git a/src/libstd/os/raw/ushort.md b/src/libstd/os/raw/ushort.md
deleted file mode 100644
index d364abb3c8e..00000000000
--- a/src/libstd/os/raw/ushort.md
+++ /dev/null
@@ -1,6 +0,0 @@
-Equivalent to C's `unsigned short` type.
-
-This type will almost always be [`u16`], but may differ on some esoteric systems. The C standard technically only requires that this type be an unsigned integer with the same size as a [`short`].
-
-[`short`]: type.c_short.html
-[`u16`]: ../../primitive.u16.html