about summary refs log tree commit diff
path: root/src/libstd/net
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2016-09-22 01:30:30 +0000
committerBrian Anderson <banderson@mozilla.com>2016-10-02 14:52:15 -0700
commit29e0235415a42299e4a7467c5edb09a159ec680e (patch)
treea23455cc0251918edc2fe61d76da9da9ac5a7a07 /src/libstd/net
parent0fb8379ed86f15943e87721f73165138598d19cc (diff)
downloadrust-29e0235415a42299e4a7467c5edb09a159ec680e.tar.gz
rust-29e0235415a42299e4a7467c5edb09a159ec680e.zip
Add a platform-abstraction tidy script
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.
Diffstat (limited to 'src/libstd/net')
-rw-r--r--src/libstd/net/mod.rs2
-rw-r--r--src/libstd/net/test.rs2
2 files changed, 3 insertions, 1 deletions
diff --git a/src/libstd/net/mod.rs b/src/libstd/net/mod.rs
index 7dd0e30df03..56286fbe253 100644
--- a/src/libstd/net/mod.rs
+++ b/src/libstd/net/mod.rs
@@ -31,7 +31,7 @@ mod addr;
 mod tcp;
 mod udp;
 mod parser;
-#[cfg(all(test, not(target_os = "emscripten")))]
+#[cfg(test)]
 mod test;
 
 /// Possible values which can be passed to the [`shutdown`] method of
diff --git a/src/libstd/net/test.rs b/src/libstd/net/test.rs
index 98ac61f6461..3f2eacda7d6 100644
--- a/src/libstd/net/test.rs
+++ b/src/libstd/net/test.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#[allow(dead_code)] // not used on emscripten
+
 use env;
 use net::{SocketAddr, SocketAddrV4, SocketAddrV6, Ipv4Addr, Ipv6Addr, ToSocketAddrs};
 use sync::atomic::{AtomicUsize, Ordering};