Expand description
Tidy check to enforce rules about platform-specific code in std.
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.
- libpanic_abort may have platform-specific code.
- libpanic_unwind may have platform-specific code.
- libunwind may have platform-specific code.
- other crates in the std facade may not.
- std may have platform-specific code in the following places:
sys/os/
std/sys_common should not contain platform-specific code.
Finally, because std contains tests with platform-specific
ignore attributes, once the parser encounters mod tests,
platform-specific cfgs are allowed. Not sure yet how to deal with
this in the long term.