diff options
| author | bors <bors@rust-lang.org> | 2013-02-28 15:21:41 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-02-28 15:21:41 -0800 |
| commit | 5680ec027088c57f8b9fa3a9aa91daaf2428a57c (patch) | |
| tree | e66d0dc80f778fb399c83a36d6acd88ea001186b /src/libstd | |
| parent | 0d30af1ebe4a803d86f47106c90ec0dc20a9d024 (diff) | |
| parent | 2df07ddc250b64151401e9b8569a6c7ad5c9b34f (diff) | |
| download | rust-5680ec027088c57f8b9fa3a9aa91daaf2428a57c.tar.gz rust-5680ec027088c57f8b9fa3a9aa91daaf2428a57c.zip | |
auto merge of #5113 : alexcrichton/rust/issue-4366, r=catamorphism
The first two commits are the actual fix going into place, and the last is just dealing with the fallout in the rest of the compiler. The test added in the first two commits had 0 failures before this patch, and if the glob imports were changed to explicit imports then the errors showed up. Due to this behavior, I figured that the desired behavior was for glob imports to not accidentally leak a lot of non-public imports/functions/types into other modules. There was quite a lot of fallout, and it all passes `make check` locally, but I doubt that it will pass on all platforms because there's probably some guarded off thing I missed. I plan on making another patch soon which changes the default level of `unused_imports` to `warn` which will hopefully reduce a lot of the `use` noise throughout. In conjunction with #5104, and a few minor fixes, I think that the default level of `warn` is actually really usable.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/arc.rs | 1 | ||||
| -rw-r--r-- | src/libstd/deque.rs | 3 | ||||
| -rw-r--r-- | src/libstd/flatpipes.rs | 3 | ||||
| -rw-r--r-- | src/libstd/future.rs | 2 | ||||
| -rw-r--r-- | src/libstd/getopts.rs | 2 | ||||
| -rw-r--r-- | src/libstd/json.rs | 1 | ||||
| -rw-r--r-- | src/libstd/net_url.rs | 168 | ||||
| -rw-r--r-- | src/libstd/sync.rs | 5 | ||||
| -rw-r--r-- | src/libstd/time.rs | 15 | ||||
| -rw-r--r-- | src/libstd/treemap.rs | 10 | ||||
| -rw-r--r-- | src/libstd/uv_global_loop.rs | 2 | ||||
| -rw-r--r-- | src/libstd/uv_iotask.rs | 214 | ||||
| -rw-r--r-- | src/libstd/uv_ll.rs | 3 |
13 files changed, 221 insertions, 208 deletions
diff --git a/src/libstd/arc.rs b/src/libstd/arc.rs index 1e2abbe0287..11eb388f9aa 100644 --- a/src/libstd/arc.rs +++ b/src/libstd/arc.rs @@ -497,6 +497,7 @@ mod tests { use arc::*; use arc; + use core::cell::Cell; use core::option::{Some, None}; use core::option; use core::pipes; diff --git a/src/libstd/deque.rs b/src/libstd/deque.rs index 4d8c60a6614..f6fcf6c8d3b 100644 --- a/src/libstd/deque.rs +++ b/src/libstd/deque.rs @@ -116,6 +116,9 @@ fn get<T>(elts: &r/[Option<T>], i: uint) -> &r/T { #[cfg(test)] mod tests { use super::*; + use core::cmp::Eq; + use core::kinds::{Durable, Copy}; + use core::prelude::debug; #[test] fn test_simple() { diff --git a/src/libstd/flatpipes.rs b/src/libstd/flatpipes.rs index 2ee994bdf32..73dbe4bea57 100644 --- a/src/libstd/flatpipes.rs +++ b/src/libstd/flatpipes.rs @@ -636,6 +636,7 @@ mod test { use DefaultEncoder = json::Encoder; use DefaultDecoder = json::Decoder; + use flatpipes::{Flattener, Unflattener}; use flatpipes::flatteners::*; use flatpipes::bytepipes::*; use flatpipes::pod; @@ -647,7 +648,7 @@ mod test { use core::dvec::DVec; use core::int; - use core::io::BytesReader; + use core::io::{BytesReader, BytesWriter}; use core::io; use core::prelude::*; use core::result; diff --git a/src/libstd/future.rs b/src/libstd/future.rs index b9c7c9f3a13..c5775406125 100644 --- a/src/libstd/future.rs +++ b/src/libstd/future.rs @@ -150,7 +150,7 @@ pub mod test { use future::*; - use core::comm::oneshot; + use core::comm::{oneshot, send_one}; use core::task; #[test] diff --git a/src/libstd/getopts.rs b/src/libstd/getopts.rs index 3726943321c..dd205583259 100644 --- a/src/libstd/getopts.rs +++ b/src/libstd/getopts.rs @@ -445,7 +445,7 @@ pub fn opt_default(mm: &Matches, nm: &str, def: &str) -> Option<~str> { } #[deriving_eq] -enum FailType { +pub enum FailType { ArgumentMissing_, UnrecognizedOption_, OptionMissing_, diff --git a/src/libstd/json.rs b/src/libstd/json.rs index c6e76aa1a68..d1a65517aad 100644 --- a/src/libstd/json.rs +++ b/src/libstd/json.rs @@ -1208,6 +1208,7 @@ mod tests { use core::prelude::*; use json::*; + use serialize; use core::result; use core::hashmap::linear::LinearMap; diff --git a/src/libstd/net_url.rs b/src/libstd/net_url.rs index 29cb57c01be..08b7b3d6ae5 100644 --- a/src/libstd/net_url.rs +++ b/src/libstd/net_url.rs @@ -730,6 +730,91 @@ impl to_bytes::IterBytes for Url { } } +// Put a few tests outside of the 'test' module so they can test the internal +// functions and those functions don't need 'pub' + +#[test] +fn test_split_char_first() { + let (u,v) = split_char_first(~"hello, sweet world", ','); + assert u == ~"hello"; + assert v == ~" sweet world"; + + let (u,v) = split_char_first(~"hello sweet world", ','); + assert u == ~"hello sweet world"; + assert v == ~""; +} + +#[test] +fn test_get_authority() { + let (u, h, p, r) = get_authority( + "//user:pass@rust-lang.org/something").unwrap(); + assert u == Some(UserInfo::new(~"user", Some(~"pass"))); + assert h == ~"rust-lang.org"; + assert p.is_none(); + assert r == ~"/something"; + + let (u, h, p, r) = get_authority( + "//rust-lang.org:8000?something").unwrap(); + assert u.is_none(); + assert h == ~"rust-lang.org"; + assert p == Some(~"8000"); + assert r == ~"?something"; + + let (u, h, p, r) = get_authority( + "//rust-lang.org#blah").unwrap(); + assert u.is_none(); + assert h == ~"rust-lang.org"; + assert p.is_none(); + assert r == ~"#blah"; + + // ipv6 tests + let (_, h, _, _) = get_authority( + "//2001:0db8:85a3:0042:0000:8a2e:0370:7334#blah").unwrap(); + assert h == ~"2001:0db8:85a3:0042:0000:8a2e:0370:7334"; + + let (_, h, p, _) = get_authority( + "//2001:0db8:85a3:0042:0000:8a2e:0370:7334:8000#blah").unwrap(); + assert h == ~"2001:0db8:85a3:0042:0000:8a2e:0370:7334"; + assert p == Some(~"8000"); + + let (u, h, p, _) = get_authority( + "//us:p@2001:0db8:85a3:0042:0000:8a2e:0370:7334:8000#blah" + ).unwrap(); + assert u == Some(UserInfo::new(~"us", Some(~"p"))); + assert h == ~"2001:0db8:85a3:0042:0000:8a2e:0370:7334"; + assert p == Some(~"8000"); + + // invalid authorities; + assert get_authority("//user:pass@rust-lang:something").is_err(); + assert get_authority("//user@rust-lang:something:/path").is_err(); + assert get_authority( + "//2001:0db8:85a3:0042:0000:8a2e:0370:7334:800a").is_err(); + assert get_authority( + "//2001:0db8:85a3:0042:0000:8a2e:0370:7334:8000:00").is_err(); + + // these parse as empty, because they don't start with '//' + let (_, h, _, _) = get_authority(~"user:pass@rust-lang").unwrap(); + assert h == ~""; + let (_, h, _, _) = get_authority(~"rust-lang.org").unwrap(); + assert h == ~""; +} + +#[test] +fn test_get_path() { + let (p, r) = get_path("/something+%20orother", true).unwrap(); + assert p == ~"/something+ orother"; + assert r == ~""; + let (p, r) = get_path("test@email.com#fragment", false).unwrap(); + assert p == ~"test@email.com"; + assert r == ~"#fragment"; + let (p, r) = get_path(~"/gen/:addr=?q=v", false).unwrap(); + assert p == ~"/gen/:addr="; + assert r == ~"?q=v"; + + //failure cases + assert get_path(~"something?q", true).is_err(); +} + #[cfg(test)] mod tests { use core::prelude::*; @@ -737,92 +822,11 @@ mod tests { use net_url::*; use net_url::UserInfo; + use core::hashmap::linear::LinearMap; use core::result; use core::str; #[test] - pub fn test_split_char_first() { - let (u,v) = split_char_first(~"hello, sweet world", ','); - assert u == ~"hello"; - assert v == ~" sweet world"; - - let (u,v) = split_char_first(~"hello sweet world", ','); - assert u == ~"hello sweet world"; - assert v == ~""; - } - - #[test] - pub fn test_get_authority() { - let (u, h, p, r) = get_authority( - "//user:pass@rust-lang.org/something").unwrap(); - assert u == Some(UserInfo::new(~"user", Some(~"pass"))); - assert h == ~"rust-lang.org"; - assert p.is_none(); - assert r == ~"/something"; - - let (u, h, p, r) = get_authority( - "//rust-lang.org:8000?something").unwrap(); - assert u.is_none(); - assert h == ~"rust-lang.org"; - assert p == Some(~"8000"); - assert r == ~"?something"; - - let (u, h, p, r) = get_authority( - "//rust-lang.org#blah").unwrap(); - assert u.is_none(); - assert h == ~"rust-lang.org"; - assert p.is_none(); - assert r == ~"#blah"; - - // ipv6 tests - let (_, h, _, _) = get_authority( - "//2001:0db8:85a3:0042:0000:8a2e:0370:7334#blah").unwrap(); - assert h == ~"2001:0db8:85a3:0042:0000:8a2e:0370:7334"; - - let (_, h, p, _) = get_authority( - "//2001:0db8:85a3:0042:0000:8a2e:0370:7334:8000#blah").unwrap(); - assert h == ~"2001:0db8:85a3:0042:0000:8a2e:0370:7334"; - assert p == Some(~"8000"); - - let (u, h, p, _) = get_authority( - "//us:p@2001:0db8:85a3:0042:0000:8a2e:0370:7334:8000#blah" - ).unwrap(); - assert u == Some(UserInfo::new(~"us", Some(~"p"))); - assert h == ~"2001:0db8:85a3:0042:0000:8a2e:0370:7334"; - assert p == Some(~"8000"); - - // invalid authorities; - assert get_authority("//user:pass@rust-lang:something").is_err(); - assert get_authority("//user@rust-lang:something:/path").is_err(); - assert get_authority( - "//2001:0db8:85a3:0042:0000:8a2e:0370:7334:800a").is_err(); - assert get_authority( - "//2001:0db8:85a3:0042:0000:8a2e:0370:7334:8000:00").is_err(); - - // these parse as empty, because they don't start with '//' - let (_, h, _, _) = get_authority(~"user:pass@rust-lang").unwrap(); - assert h == ~""; - let (_, h, _, _) = get_authority(~"rust-lang.org").unwrap(); - assert h == ~""; - } - - #[test] - pub fn test_get_path() { - let (p, r) = get_path("/something+%20orother", true).unwrap(); - assert p == ~"/something+ orother"; - assert r == ~""; - let (p, r) = get_path("test@email.com#fragment", false).unwrap(); - assert p == ~"test@email.com"; - assert r == ~"#fragment"; - let (p, r) = get_path(~"/gen/:addr=?q=v", false).unwrap(); - assert p == ~"/gen/:addr="; - assert r == ~"?q=v"; - - //failure cases - assert get_path(~"something?q", true).is_err(); - } - - #[test] pub fn test_url_parse() { let url = ~"http://user:pass@rust-lang.org/doc?s=v#something"; diff --git a/src/libstd/sync.rs b/src/libstd/sync.rs index 22325e6a83c..39d3fd569a6 100644 --- a/src/libstd/sync.rs +++ b/src/libstd/sync.rs @@ -399,7 +399,7 @@ pub impl &Semaphore { * A task which fails while holding a mutex will unlock the mutex as it * unwinds. */ -struct Mutex { priv sem: Sem<~[Waitqueue]> } +pub struct Mutex { priv sem: Sem<~[Waitqueue]> } /// Create a new mutex, with one associated condvar. pub fn Mutex() -> Mutex { mutex_with_condvars(1) } @@ -447,7 +447,7 @@ struct RWlockInner { * A task which fails while holding an rwlock will unlock the rwlock as it * unwinds. */ -struct RWlock { +pub struct RWlock { priv order_lock: Semaphore, priv access_lock: Sem<~[Waitqueue]>, priv state: Exclusive<RWlockInner> @@ -712,6 +712,7 @@ mod tests { use sync::*; use core::cast; + use core::cell::Cell; use core::option; use core::pipes; use core::ptr; diff --git a/src/libstd/time.rs b/src/libstd/time.rs index 15dea83815b..6e80665d80e 100644 --- a/src/libstd/time.rs +++ b/src/libstd/time.rs @@ -892,6 +892,7 @@ mod tests { use core::float; use core::os; use core::result; + use core::result::{Err, Ok}; use core::str; use core::u64; use core::uint; @@ -902,15 +903,13 @@ mod tests { const some_future_date: i64 = 1577836800i64; // 2020-01-01T00:00:00Z let tv1 = get_time(); - log(debug, ~"tv1=" + uint::to_str(tv1.sec as uint) + ~" sec + " - + uint::to_str(tv1.nsec as uint) + ~" nsec"); + debug!("tv1=%? sec + %? nsec", tv1.sec as uint, tv1.nsec as uint); assert tv1.sec > some_recent_date; assert tv1.nsec < 1000000000i32; let tv2 = get_time(); - log(debug, ~"tv2=" + uint::to_str(tv2.sec as uint) + ~" sec + " - + uint::to_str(tv2.nsec as uint) + ~" nsec"); + debug!("tv2=%? sec + %? nsec", tv2.sec as uint, tv2.nsec as uint); assert tv2.sec >= tv1.sec; assert tv2.sec < some_future_date; @@ -924,16 +923,16 @@ mod tests { let s0 = precise_time_s(); let ns1 = precise_time_ns(); - log(debug, ~"s0=" + float::to_str_digits(s0, 9u) + ~" sec"); + debug!("s0=%s sec", float::to_str_digits(s0, 9u)); assert s0 > 0.; let ns0 = (s0 * 1000000000.) as u64; - log(debug, ~"ns0=" + u64::to_str(ns0) + ~" ns"); + debug!("ns0=%? ns", ns0); - log(debug, ~"ns1=" + u64::to_str(ns1) + ~" ns"); + debug!("ns1=%? ns", ns0); assert ns1 >= ns0; let ns2 = precise_time_ns(); - log(debug, ~"ns2=" + u64::to_str(ns2) + ~" ns"); + debug!("ns2=%? ns", ns0); assert ns2 >= ns1; } diff --git a/src/libstd/treemap.rs b/src/libstd/treemap.rs index cf863217deb..88e4ade4b82 100644 --- a/src/libstd/treemap.rs +++ b/src/libstd/treemap.rs @@ -207,8 +207,8 @@ pub struct TreeMapIterator<K, V> { /// Advance the iterator to the next node (in order) and return a /// tuple with a reference to the key and value. If there are no /// more nodes, return `None`. -fn map_next<K: Ord, V>(iter: &mut TreeMapIterator/&r<K, V>) - -> Option<(&r/K, &r/V)> { +pub fn map_next<K: Ord, V>(iter: &mut TreeMapIterator/&r<K, V>) + -> Option<(&r/K, &r/V)> { while !iter.stack.is_empty() || iter.node.is_some() { match *iter.node { Some(ref x) => { @@ -226,7 +226,7 @@ fn map_next<K: Ord, V>(iter: &mut TreeMapIterator/&r<K, V>) } /// Advance the iterator through the map -fn map_advance<K: Ord, V>(iter: &mut TreeMapIterator/&r<K, V>, +pub fn map_advance<K: Ord, V>(iter: &mut TreeMapIterator/&r<K, V>, f: fn((&r/K, &r/V)) -> bool) { loop { match map_next(iter) { @@ -683,7 +683,11 @@ fn remove<K:Ord,V>(node: &mut Option<~TreeNode<K, V>>, key: &K) -> bool { #[cfg(test)] mod test_treemap { use super::*; + use core::cmp::{Ord, Eq}; + use core::option::{Some, Option, None}; + use core::rand; use core::str; + use core::vec; #[test] fn find_empty() { diff --git a/src/libstd/uv_global_loop.rs b/src/libstd/uv_global_loop.rs index 401cecf8811..37d9b3221b2 100644 --- a/src/libstd/uv_global_loop.rs +++ b/src/libstd/uv_global_loop.rs @@ -123,9 +123,11 @@ fn spawn_loop() -> IoTask { mod test { use core::prelude::*; + use get_gl = get; use uv::iotask; use uv::ll; use uv_global_loop::*; + use uv_iotask::IoTask; use core::iter; use core::libc; diff --git a/src/libstd/uv_iotask.rs b/src/libstd/uv_iotask.rs index 52956f152fe..14726a0854d 100644 --- a/src/libstd/uv_iotask.rs +++ b/src/libstd/uv_iotask.rs @@ -202,124 +202,120 @@ extern fn tear_down_close_cb(handle: *ll::uv_async_t) { } #[cfg(test)] -mod test { - use core::prelude::*; - - use uv::ll; - use uv_iotask::*; - - use core::iter; - use core::libc; - use core::ptr; - use core::task; - use core::pipes::{stream, Chan, SharedChan, Port}; - - extern fn async_close_cb(handle: *ll::uv_async_t) { - unsafe { - log(debug, fmt!("async_close_cb handle %?", handle)); - let exit_ch = &(*(ll::get_data_for_uv_handle(handle) - as *AhData)).exit_ch; - let exit_ch = exit_ch.clone(); - exit_ch.send(()); - } - } - extern fn async_handle_cb(handle: *ll::uv_async_t, status: libc::c_int) { - unsafe { - log(debug, - fmt!("async_handle_cb handle %? status %?",handle,status)); - ll::close(handle, async_close_cb); - } - } - struct AhData { - iotask: IoTask, - exit_ch: SharedChan<()> +extern fn async_close_cb(handle: *ll::uv_async_t) { + unsafe { + log(debug, fmt!("async_close_cb handle %?", handle)); + let exit_ch = &(*(ll::get_data_for_uv_handle(handle) + as *AhData)).exit_ch; + let exit_ch = exit_ch.clone(); + exit_ch.send(()); } - fn impl_uv_iotask_async(iotask: &IoTask) { - unsafe { - let async_handle = ll::async_t(); - let ah_ptr = ptr::addr_of(&async_handle); - let (exit_po, exit_ch) = stream::<()>(); - let ah_data = AhData { - iotask: iotask.clone(), - exit_ch: SharedChan(exit_ch) - }; - let ah_data_ptr: *AhData = unsafe { - ptr::to_unsafe_ptr(&ah_data) - }; - debug!("about to interact"); - do interact(iotask) |loop_ptr| { - unsafe { - debug!("interacting"); - ll::async_init(loop_ptr, ah_ptr, async_handle_cb); - ll::set_data_for_uv_handle( - ah_ptr, ah_data_ptr as *libc::c_void); - ll::async_send(ah_ptr); - } - }; - debug!("waiting for async close"); - exit_po.recv(); - } +} + +#[cfg(test)] +extern fn async_handle_cb(handle: *ll::uv_async_t, status: libc::c_int) { + unsafe { + log(debug, + fmt!("async_handle_cb handle %? status %?",handle,status)); + ll::close(handle, async_close_cb); } +} + +#[cfg(test)] +struct AhData { + iotask: IoTask, + exit_ch: SharedChan<()> +} - // this fn documents the bear minimum neccesary to roll your own - // high_level_loop - unsafe fn spawn_test_loop(exit_ch: ~Chan<()>) -> IoTask { - let (iotask_port, iotask_ch) = stream::<IoTask>(); - do task::spawn_sched(task::ManualThreads(1u)) { - debug!("about to run a test loop"); - run_loop(&iotask_ch); - exit_ch.send(()); +#[cfg(test)] +fn impl_uv_iotask_async(iotask: &IoTask) { + unsafe { + let async_handle = ll::async_t(); + let ah_ptr = ptr::addr_of(&async_handle); + let (exit_po, exit_ch) = stream::<()>(); + let ah_data = AhData { + iotask: iotask.clone(), + exit_ch: SharedChan(exit_ch) + }; + let ah_data_ptr: *AhData = unsafe { + ptr::to_unsafe_ptr(&ah_data) }; - return iotask_port.recv(); + debug!("about to interact"); + do interact(iotask) |loop_ptr| { + unsafe { + debug!("interacting"); + ll::async_init(loop_ptr, ah_ptr, async_handle_cb); + ll::set_data_for_uv_handle( + ah_ptr, ah_data_ptr as *libc::c_void); + ll::async_send(ah_ptr); + } + }; + debug!("waiting for async close"); + exit_po.recv(); } +} - extern fn lifetime_handle_close(handle: *libc::c_void) { - unsafe { - log(debug, fmt!("lifetime_handle_close ptr %?", handle)); - } - } +// this fn documents the bear minimum neccesary to roll your own +// high_level_loop +#[cfg(test)] +unsafe fn spawn_test_loop(exit_ch: ~Chan<()>) -> IoTask { + let (iotask_port, iotask_ch) = stream::<IoTask>(); + do task::spawn_sched(task::ManualThreads(1u)) { + debug!("about to run a test loop"); + run_loop(&iotask_ch); + exit_ch.send(()); + }; + return iotask_port.recv(); +} - extern fn lifetime_async_callback(handle: *libc::c_void, - status: libc::c_int) { - log(debug, fmt!("lifetime_handle_close ptr %? status %?", - handle, status)); +#[cfg(test)] +extern fn lifetime_handle_close(handle: *libc::c_void) { + unsafe { + log(debug, fmt!("lifetime_handle_close ptr %?", handle)); } +} - #[test] - fn test_uv_iotask_async() { - unsafe { - let (exit_po, exit_ch) = stream::<()>(); - let iotask = &spawn_test_loop(~exit_ch); - - debug!("spawned iotask"); - - // using this handle to manage the lifetime of the - // high_level_loop, as it will exit the first time one of - // the impl_uv_hl_async() is cleaned up with no one ref'd - // handles on the loop (Which can happen under - // race-condition type situations.. this ensures that the - // loop lives until, at least, all of the - // impl_uv_hl_async() runs have been called, at least. - let (work_exit_po, work_exit_ch) = stream::<()>(); - let work_exit_ch = SharedChan(work_exit_ch); - for iter::repeat(7u) { - let iotask_clone = iotask.clone(); - let work_exit_ch_clone = work_exit_ch.clone(); - do task::spawn_sched(task::ManualThreads(1u)) { - debug!("async"); - impl_uv_iotask_async(&iotask_clone); - debug!("done async"); - work_exit_ch_clone.send(()); - }; - }; - for iter::repeat(7u) { - debug!("waiting"); - work_exit_po.recv(); +#[cfg(test)] +extern fn lifetime_async_callback(handle: *libc::c_void, + status: libc::c_int) { + log(debug, fmt!("lifetime_handle_close ptr %? status %?", + handle, status)); +} + +#[test] +fn test_uv_iotask_async() { + unsafe { + let (exit_po, exit_ch) = stream::<()>(); + let iotask = &spawn_test_loop(~exit_ch); + + debug!("spawned iotask"); + + // using this handle to manage the lifetime of the + // high_level_loop, as it will exit the first time one of + // the impl_uv_hl_async() is cleaned up with no one ref'd + // handles on the loop (Which can happen under + // race-condition type situations.. this ensures that the + // loop lives until, at least, all of the + // impl_uv_hl_async() runs have been called, at least. + let (work_exit_po, work_exit_ch) = stream::<()>(); + let work_exit_ch = SharedChan(work_exit_ch); + for iter::repeat(7u) { + let iotask_clone = iotask.clone(); + let work_exit_ch_clone = work_exit_ch.clone(); + do task::spawn_sched(task::ManualThreads(1u)) { + debug!("async"); + impl_uv_iotask_async(&iotask_clone); + debug!("done async"); + work_exit_ch_clone.send(()); }; - log(debug, ~"sending teardown_loop msg.."); - exit(iotask); - exit_po.recv(); - log(debug, ~"after recv on exit_po.. exiting.."); - } + }; + for iter::repeat(7u) { + debug!("waiting"); + work_exit_po.recv(); + }; + log(debug, ~"sending teardown_loop msg.."); + exit(iotask); + exit_po.recv(); + log(debug, ~"after recv on exit_po.. exiting.."); } } diff --git a/src/libstd/uv_ll.rs b/src/libstd/uv_ll.rs index dd54620c83d..b7111bfb023 100644 --- a/src/libstd/uv_ll.rs +++ b/src/libstd/uv_ll.rs @@ -1199,6 +1199,7 @@ pub mod test { use uv_ll::*; + use core::comm::{SharedChan, stream}; use core::libc; use core::ptr; use core::str; @@ -1687,7 +1688,7 @@ pub mod test { // this is the impl for a test that is (maybe) ran on a // per-platform/arch basis below - fn impl_uv_tcp_server_and_request() { + pub fn impl_uv_tcp_server_and_request() { unsafe { let bind_ip = ~"0.0.0.0"; let request_ip = ~"127.0.0.1"; |
