diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-07-30 08:53:22 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-08-04 14:02:36 -0700 |
| commit | 0d8340327c03f319b49cb91e2e64aa66dd1e76c7 (patch) | |
| tree | 308af0af76da6c6a020ee5e8d9e5dbb40152307a /src/libstd | |
| parent | 5cccf3cd256420d9f32c265e83036dea1d5f94d8 (diff) | |
| download | rust-0d8340327c03f319b49cb91e2e64aa66dd1e76c7.tar.gz rust-0d8340327c03f319b49cb91e2e64aa66dd1e76c7.zip | |
syntax: Don't assume `std` exists for tests
This commit removes the injection of `std::env::args()` from `--test` expanded code, relying on the test runner itself to call this funciton. This is more hygienic because we can't assume that `std` exists at the top layer all the time, and it meaks the injected test module entirely self contained.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/lib.rs | 8 | ||||
| -rw-r--r-- | src/libstd/process.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys/unix/thread.rs | 1 | ||||
| -rw-r--r-- | src/libstd/sys/windows/thread.rs | 2 | ||||
| -rw-r--r-- | src/libstd/thread/local.rs | 1 |
5 files changed, 4 insertions, 10 deletions
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index a694a9280dc..7baa7558e52 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -414,11 +414,3 @@ pub mod __rand { // the rustdoc documentation for primitive types. Using `include!` // because rustdoc only looks for these modules at the crate level. include!("primitive_docs.rs"); - -// The expansion of --test has a few references to `::std::$foo` so this module -// is necessary to get things to compile. -#[cfg(test)] -mod std { - pub use option; - pub use realstd::env; -} diff --git a/src/libstd/process.rs b/src/libstd/process.rs index 74a66558627..be921d9aef0 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -815,7 +815,7 @@ mod tests { #[cfg(target_os="android")] #[test] fn test_inherit_env() { - use std::env; + use env; let mut result = env_cmd().output().unwrap(); let output = String::from_utf8(result.stdout).unwrap(); diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs index 6be61f06926..67ecd4d9229 100644 --- a/src/libstd/sys/unix/thread.rs +++ b/src/libstd/sys/unix/thread.rs @@ -166,6 +166,7 @@ impl Drop for Thread { not(target_os = "netbsd"), not(target_os = "openbsd")))] pub mod guard { + #[cfg(stage0)] use prelude::v1::*; pub unsafe fn current() -> Option<usize> { None } diff --git a/src/libstd/sys/windows/thread.rs b/src/libstd/sys/windows/thread.rs index a4131d4cada..15df5d756be 100644 --- a/src/libstd/sys/windows/thread.rs +++ b/src/libstd/sys/windows/thread.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[cfg(stage0)] use prelude::v1::*; use alloc::boxed::FnBox; @@ -87,6 +86,7 @@ impl Thread { } pub mod guard { + #[cfg(stage0)] use prelude::v1::*; pub unsafe fn current() -> Option<usize> { None } diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs index a6ecd2d88d2..0615033736e 100644 --- a/src/libstd/thread/local.rs +++ b/src/libstd/thread/local.rs @@ -329,6 +329,7 @@ mod imp { // Due to rust-lang/rust#18804, make sure this is not generic! #[cfg(target_os = "linux")] unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern fn(*mut u8)) { + use prelude::v1::*; use mem; use libc; use sys_common::thread_local as os; |
