Restrict where in the tree platform-specific cfgs may be mentioned#36807
Restrict where in the tree platform-specific cfgs may be mentioned#36807bors merged 7 commits intorust-lang:masterfrom
Conversation
|
r? @aturon (rust_highfive has picked a reviewer for you, use r? to override) |
|
Looks great to me! |
src/libstd/sys/windows/env.rs
Outdated
There was a problem hiding this comment.
This can be removed I think
|
Updated. |
|
I did some more refactoring, moving the argument handling around. That'll surely bounce a few times on misc platforms... |
|
@bors: r+ |
|
📌 Commit 2086608 has been approved by |
|
@bors r=alexcrichton |
|
📌 Commit 54440be has been approved by |
|
@bors r=alexcrichton |
|
📌 Commit 5cf31ba has been approved by |
|
@bors r=alexcrichton |
|
📌 Commit 1472c45 has been approved by |
|
⌛ Testing commit 1472c45 with merge dbcc5b1... |
|
💔 Test failed - auto-win-gnu-32-opt-rustbuild |
|
@bors r=alexcrichton |
|
📌 Commit ba9e75e has been approved by |
|
@bors r=alexcrichton |
|
@bors r=alexcrichton |
|
📌 Commit 1a30e0f has been approved by |
|
⌛ Testing commit 1a30e0f with merge bdded68... |
|
💔 Test failed - auto-mac-cross-ios-opt |
|
@bors r=alexcrichton |
|
📌 Commit 405c010 has been approved by |
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
|
💔 Test failed - auto-win-msvc-32-opt |
|
@bors r=alexcrichton |
|
📌 Commit 61afff3 has been approved by |
|
⌛ Testing commit 61afff3 with merge f3add2e... |
|
💔 Test failed - auto-linux-32-opt |
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.
|
@bors r+ |
|
📌 Commit 4d76ac8 has been approved by |
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
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)andcfg(target_env)may appear,the basic objective being to isolate platform-specific code to the
platform-specific
std::sysmodules, and to the allocation,unwinding, and libc crates.
Following are the basic rules, though there are currently
exceptions:
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