diff options
| author | Kevin Ballard <kevin@sb.org> | 2014-05-25 16:31:46 -0700 |
|---|---|---|
| committer | Kevin Ballard <kevin@sb.org> | 2014-05-25 16:37:19 -0700 |
| commit | 009d898a9422ac04c1aa60c0e9aff3abc5fa4672 (patch) | |
| tree | a460ca943e21d6cd34212fd823b0236c9c868a52 /src/libstd/rt | |
| parent | 69070ac85fcf930b02e2c75bc161a75c5742e138 (diff) | |
| download | rust-009d898a9422ac04c1aa60c0e9aff3abc5fa4672.tar.gz rust-009d898a9422ac04c1aa60c0e9aff3abc5fa4672.zip | |
De-realstd os::args
With the test runner using ::std::os::args(), and std::std::os now being a re-export of realstd::os, there's no more need for realstd stuff mucking up rt::args. Remove the one test of os::args(), as it's not very useful and it won't work anymore now that rt::args doesn't use realstd.
Diffstat (limited to 'src/libstd/rt')
| -rw-r--r-- | src/libstd/rt/args.rs | 41 |
1 files changed, 7 insertions, 34 deletions
diff --git a/src/libstd/rt/args.rs b/src/libstd/rt/args.rs index 4316fb21d41..e016c9da418 100644 --- a/src/libstd/rt/args.rs +++ b/src/libstd/rt/args.rs @@ -22,47 +22,23 @@ use option::Option; use vec::Vec; -#[cfg(test)] use option::{Some, None}; -#[cfg(test)] use realstd; -#[cfg(test)] use realargs = realstd::rt::args; /// One-time global initialization. -#[cfg(not(test))] pub unsafe fn init(argc: int, argv: **u8) { imp::init(argc, argv) } -#[cfg(test)] -pub unsafe fn init(argc: int, argv: **u8) { realargs::init(argc, argv) } /// One-time global cleanup. -#[cfg(not(test))] pub unsafe fn cleanup() { imp::cleanup() } -#[cfg(test)] pub unsafe fn cleanup() { realargs::cleanup() } +pub unsafe fn cleanup() { imp::cleanup() } /// Take the global arguments from global storage. -#[cfg(not(test))] pub fn take() -> Option<Vec<Vec<u8>>> { imp::take() } -#[cfg(test)] pub fn take() -> Option<Vec<Vec<u8>>> { - match realargs::take() { - realstd::option::Some(v) => Some(unsafe{ ::mem::transmute(v) }), - realstd::option::None => None, - } -} +pub fn take() -> Option<Vec<Vec<u8>>> { imp::take() } /// Give the global arguments to global storage. /// /// It is an error if the arguments already exist. -#[cfg(not(test))] pub fn put(args: Vec<Vec<u8>>) { imp::put(args) } -#[cfg(test)] pub fn put(args: Vec<Vec<u8>>) { - realargs::put(unsafe { - ::mem::transmute(args) - }) -} +pub fn put(args: Vec<Vec<u8>>) { imp::put(args) } /// Make a clone of the global arguments. -#[cfg(not(test))] pub fn clone() -> Option<Vec<Vec<u8>>> { imp::clone() } -#[cfg(test)] pub fn clone() -> Option<Vec<Vec<u8>>> { - match realargs::clone() { - realstd::option::Some(v) => Some(unsafe { ::mem::transmute(v) }), - realstd::option::None => None, - } -} +pub fn clone() -> Option<Vec<Vec<u8>>> { imp::clone() } #[cfg(target_os = "linux")] #[cfg(target_os = "android")] @@ -75,18 +51,16 @@ mod imp { use unstable::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT}; use mem; use vec::Vec; - #[cfg(not(test))] use ptr::RawPtr; + use ptr::RawPtr; static mut global_args_ptr: uint = 0; static mut lock: StaticNativeMutex = NATIVE_MUTEX_INIT; - #[cfg(not(test))] pub unsafe fn init(argc: int, argv: **u8) { let args = load_argc_and_argv(argc, argv); put(args); } - #[cfg(not(test))] pub unsafe fn cleanup() { rtassert!(take().is_some()); lock.destroy(); @@ -127,7 +101,6 @@ mod imp { } // Copied from `os`. - #[cfg(not(test))] unsafe fn load_argc_and_argv(argc: int, argv: **u8) -> Vec<Vec<u8>> { use c_str::CString; use ptr::RawPtr; @@ -173,8 +146,8 @@ mod imp { } } -#[cfg(target_os = "macos", not(test))] -#[cfg(target_os = "win32", not(test))] +#[cfg(target_os = "macos")] +#[cfg(target_os = "win32")] mod imp { use option::Option; use vec::Vec; |
