rust/src/libstd
bors 144af3e97a Auto merge of #36807 - brson:pal, r=brson
Restrict where in the tree platform-specific cfgs may be mentioned

With the ports of Rust never ending, it's important that we keep things tidy. The main thing this PR does is introduce  a new "pal" (platform abstraction layer) tidy check that limits where platform-specific CFGs may appear.

This is intended to maintain existing standards of code organization
in hopes that the standard library will continue to be refactored to
isolate platform-specific bits, making porting easier; where "standard
library" roughly means "all the dependencies of the std and test
crates".

This generally means placing restrictions on where `cfg(unix)`,
`cfg(windows)`, `cfg(target_os)` and `cfg(target_env)` may appear,
the basic objective being to isolate platform-specific code to the
platform-specific `std::sys` modules, and to the allocation,
unwinding, and libc crates.

Following are the basic rules, though there are currently
exceptions:

- core may not have platform-specific code
- liballoc_system may have platform-specific code
- liballoc_jemalloc may have platform-specific code
- libpanic_abort may have platform-specific code
- libpanic_unwind may have platform-specific code
- other crates in the std facade may not
- std may have platform-specific code in the following places
  - sys/unix/
  - sys/windows/
  - os/

There are plenty of exceptions today though, noted in the whitelist.

The end-state, IMO, is for the standard library to be portable by porting only `std::sys` (possibly extracted to its own crate), an allocator crate, an unwinder crate, and possibly a libc crate (if std depends on it); but that outcome is far off and independent of the utility of enforcing where such code lives today.

cc @rust-lang/libs
2016-10-02 17:33:34 -07:00
..
collections Auto merge of #36557 - sfackler:fix-hashdos-docs, r=alexcrichton 2016-09-29 20:25:45 -07:00
ffi std: Remove plattform-specific code from os_str 2016-10-01 19:33:02 +00:00
io std: Move platform specific stdio code into sys 2016-10-01 19:33:02 +00:00
net Add a platform-abstraction tidy script 2016-10-02 14:52:15 -07:00
num Use #[prelude_import] in libstd. 2016-08-24 22:12:48 +00:00
os Preliminary wasm32 support 2016-09-30 14:02:45 -07:00
prelude End stdlib module summaries with a full stop. 2016-03-04 17:37:11 -05:00
rand Ignore lots and lots of std tests on emscripten 2016-09-30 14:02:48 -07:00
sync Add a platform-abstraction tidy script 2016-10-02 14:52:15 -07:00
sys Move platform-specific arg handling to sys::args 2016-10-02 14:52:30 -07:00
thread Auto merge of #36339 - brson:emscripten-new, r=alexcrichton 2016-09-30 19:00:36 -07:00
time Reword description of SystemTimeError. 2016-09-29 20:08:46 +02:00
ascii.rs Use #[prelude_import] in libstd. 2016-08-24 22:12:48 +00:00
build.rs Report which required build-time environment variable is not set 2016-09-25 12:18:09 -04:00
Cargo.toml crate-ify compiler-rt into compiler-builtins 2016-09-12 21:22:15 -07:00
env.rs Move platform-specific arg handling to sys::args 2016-10-02 14:52:30 -07:00
error.rs Implement TryFrom<u32> for char 2016-08-29 17:34:02 +02:00
fs.rs Ignore various entire test modules on emscripten 2016-09-30 14:02:56 -07:00
lib.rs Remove stage0 hacks 2016-09-28 23:17:56 +00:00
macros.rs Auto merge of #36404 - christopherdumas:master, r=GuillaumeGomez 2016-10-02 08:32:07 -07:00
memchr.rs std: Move platform specific memchr code into sys 2016-10-01 19:33:02 +00:00
panic.rs Use #[prelude_import] in libstd. 2016-08-24 22:12:48 +00:00
panicking.rs Add basic doc examples for std::panic::{set_hook, take_hook}. 2016-09-18 10:03:34 -04:00
path.rs std: Move platform specific path code into sys 2016-10-01 19:28:17 +00:00
primitive_docs.rs Tweak array docs 2016-09-11 12:36:24 -07:00
process.rs Auto merge of #36339 - brson:emscripten-new, r=alexcrichton 2016-09-30 19:00:36 -07:00
rt.rs Move platform-specific arg handling to sys::args 2016-10-02 14:52:30 -07:00
rtdeps.rs Add support for the Haiku operating system on x86 and x86_64 machines 2016-09-25 11:12:23 -05:00