diff --git a/src/libcore/cleanup.rs b/src/libcore/cleanup.rs index 064387dd6b8..df6074e3200 100644 --- a/src/libcore/cleanup.rs +++ b/src/libcore/cleanup.rs @@ -10,8 +10,6 @@ use repr::BoxRepr; use sys::TypeDesc; use cast::transmute; -export annihilate; - /** * Runtime structures * diff --git a/src/libcore/cmath.rs b/src/libcore/cmath.rs index 11f26c24b94..9a9a7cb3112 100644 --- a/src/libcore/cmath.rs +++ b/src/libcore/cmath.rs @@ -3,10 +3,6 @@ #[forbid(deprecated_mode)]; #[forbid(deprecated_pattern)]; -// uncomment once #1433 is fixed -// FIXME (#1433): export c_float_math_consts; -// FIXME (#1433): export c_double_math_consts; - use libc::c_int; use libc::c_float; use libc::c_double; @@ -193,66 +189,62 @@ pub mod c_double_targ_consts { FIXME use these once they can be parsed (see Issue #1433) -mod c_float_math_consts { - #[legacy_exports]; - const pi: c_float = 0x1.921fb6p+1_f32; - const div_1_pi: c_float = 0x1.45f306p-2_f32; - const div_2_pi: c_float = 0x1.45f306p-1_f32; - const div_pi_2: c_float = 0x1.921fb6p+0_f32; - const div_pi_4: c_float = 0x1.921fb6p-1_f32; - const div_2_sqrtpi: c_float = 0x1.20dd76p+0_f32; - const e: c_float = 0x1.5bf0a8p+1_f32; - const log2_e: c_float = 0x1.715476p+0_f32; - const log10_e: c_float = 0x1.bcb7b2p-2_f32; - const ln_2: c_float = 0x1.62e43p-1_f32; - const ln_10: c_float = 0x1.26bb1cp+1_f32; - const sqrt2: c_float = 0x1.6a09e6p+0_f32; - const div_1_sqrt2: c_float = 0x1.6a09e6p-1_f32; +pub mod c_float_math_consts { + pub const pi: c_float = 0x1.921fb6p+1_f32; + pub const div_1_pi: c_float = 0x1.45f306p-2_f32; + pub const div_2_pi: c_float = 0x1.45f306p-1_f32; + pub const div_pi_2: c_float = 0x1.921fb6p+0_f32; + pub const div_pi_4: c_float = 0x1.921fb6p-1_f32; + pub const div_2_sqrtpi: c_float = 0x1.20dd76p+0_f32; + pub const e: c_float = 0x1.5bf0a8p+1_f32; + pub const log2_e: c_float = 0x1.715476p+0_f32; + pub const log10_e: c_float = 0x1.bcb7b2p-2_f32; + pub const ln_2: c_float = 0x1.62e43p-1_f32; + pub const ln_10: c_float = 0x1.26bb1cp+1_f32; + pub const sqrt2: c_float = 0x1.6a09e6p+0_f32; + pub const div_1_sqrt2: c_float = 0x1.6a09e6p-1_f32; } -mod c_double_math_consts { - #[legacy_exports]; - const pi: c_double = 0x1.921fb54442d18p+1_f64; - const div_1_pi: c_double = 0x1.45f306dc9c883p-2_f64; - const div_2_pi: c_double = 0x1.45f306dc9c883p-1_f64; - const div_pi_2: c_double = 0x1.921fb54442d18p+0_f64; - const div_pi_4: c_double = 0x1.921fb54442d18p-1_f64; - const div_2_sqrtpi: c_double = 0x1.20dd750429b6dp+0_f64; - const e: c_double = 0x1.5bf0a8b145769p+1_f64; - const log2_e: c_double = 0x1.71547652b82fep+0_f64; - const log10_e: c_double = 0x1.bcb7b1526e50ep-2_f64; - const ln_2: c_double = 0x1.62e42fefa39efp-1_f64; - const ln_10: c_double = 0x1.26bb1bbb55516p+1_f64; - const sqrt2: c_double = 0x1.6a09e667f3bcdp+0_f64; - const div_1_sqrt2: c_double = 0x1.6a09e667f3bcdp-1_f64; +pub mod c_double_math_consts { + pub const pi: c_double = 0x1.921fb54442d18p+1_f64; + pub const div_1_pi: c_double = 0x1.45f306dc9c883p-2_f64; + pub const div_2_pi: c_double = 0x1.45f306dc9c883p-1_f64; + pub const div_pi_2: c_double = 0x1.921fb54442d18p+0_f64; + pub const div_pi_4: c_double = 0x1.921fb54442d18p-1_f64; + pub const div_2_sqrtpi: c_double = 0x1.20dd750429b6dp+0_f64; + pub const e: c_double = 0x1.5bf0a8b145769p+1_f64; + pub const log2_e: c_double = 0x1.71547652b82fep+0_f64; + pub const log10_e: c_double = 0x1.bcb7b1526e50ep-2_f64; + pub const ln_2: c_double = 0x1.62e42fefa39efp-1_f64; + pub const ln_10: c_double = 0x1.26bb1bbb55516p+1_f64; + pub const sqrt2: c_double = 0x1.6a09e667f3bcdp+0_f64; + pub const div_1_sqrt2: c_double = 0x1.6a09e667f3bcdp-1_f64; } -mod c_float_targ_consts { - #[legacy_exports]; - const radix: uint = 2u; - const mantissa_digits: uint = 24u; - const digits: uint = 6u; - const min_exp: int = -125; - const max_exp: int = 128; - const min_10_exp: int = -37; - const max_10_exp: int = 38; - const min_value: c_float = 0x1p-126_f32; - const max_value: c_float = 0x1.fffffep+127_f32; - const epsilon: c_float = 0x1p-23_f32; +pub mod c_float_targ_consts { + pub const radix: uint = 2u; + pub const mantissa_digits: uint = 24u; + pub const digits: uint = 6u; + pub const min_exp: int = -125; + pub const max_exp: int = 128; + pub const min_10_exp: int = -37; + pub const max_10_exp: int = 38; + pub const min_value: c_float = 0x1p-126_f32; + pub const max_value: c_float = 0x1.fffffep+127_f32; + pub const epsilon: c_float = 0x1p-23_f32; } -mod c_double_targ_consts { - #[legacy_exports]; - const radix: uint = 2u; - const mantissa_digits: uint = 53u; - const digits: uint = 15u; - const min_exp: int = -1021; - const max_exp: int = 1024; - const min_10_exp: int = -307; - const max_10_exp: int = 308; - const min_value: c_double = 0x1p-1022_f64; - const max_value: c_double = 0x1.fffffffffffffp+1023_f64; - const epsilon: c_double = 0x1p-52_f64; +pub mod c_double_targ_consts { + pub const radix: uint = 2u; + pub const mantissa_digits: uint = 53u; + pub const digits: uint = 15u; + pub const min_exp: int = -1021; + pub const max_exp: int = 1024; + pub const min_10_exp: int = -307; + pub const max_10_exp: int = 308; + pub const min_value: c_double = 0x1p-1022_f64; + pub const max_value: c_double = 0x1.fffffffffffffp+1023_f64; + pub const epsilon: c_double = 0x1p-52_f64; } */ diff --git a/src/libcore/future.rs b/src/libcore/future.rs index 35b3ffe040c..db311ea3e82 100644 --- a/src/libcore/future.rs +++ b/src/libcore/future.rs @@ -19,20 +19,8 @@ use either::Either; use pipes::recv; use cast::copy_lifetime; -export Future; -export extensions; -export from_value; -export from_port; -export from_fn; -export get; -export with; -export spawn; - -// for task.rs -export future_pipe; - #[doc = "The future type"] -struct Future { +pub struct Future { /*priv*/ mut state: FutureState, // FIXME(#2829) -- futures should not be copyable, because they close @@ -67,7 +55,7 @@ impl Future { } } -fn from_value(+val: A) -> Future { +pub fn from_value(+val: A) -> Future { /*! * Create a future from a value * @@ -78,7 +66,8 @@ fn from_value(+val: A) -> Future { Future {state: Forced(~(move val))} } -fn from_port(+port: future_pipe::client::waiting) -> Future { +pub fn from_port(+port: future_pipe::client::waiting) -> + Future { /*! * Create a future from a port * @@ -97,7 +86,7 @@ fn from_port(+port: future_pipe::client::waiting) -> Future { } } -fn from_fn(+f: ~fn() -> A) -> Future { +pub fn from_fn(+f: ~fn() -> A) -> Future { /*! * Create a future from a function. * @@ -109,7 +98,7 @@ fn from_fn(+f: ~fn() -> A) -> Future { Future {state: Pending(move f)} } -fn spawn(+blk: fn~() -> A) -> Future { +pub fn spawn(+blk: fn~() -> A) -> Future { /*! * Create a future from a unique closure. * @@ -122,7 +111,7 @@ fn spawn(+blk: fn~() -> A) -> Future { })) } -fn get_ref(future: &r/Future) -> &r/A { +pub fn get_ref(future: &r/Future) -> &r/A { /*! * Executes the future's closure and then returns a borrowed * pointer to the result. The borrowed pointer lasts as long as @@ -160,13 +149,13 @@ fn get_ref(future: &r/Future) -> &r/A { } } -fn get(future: &Future) -> A { +pub fn get(future: &Future) -> A { //! Get the value of the future *get_ref(future) } -fn with(future: &Future, blk: fn((&A)) -> B) -> B { +pub fn with(future: &Future, blk: fn((&A)) -> B) -> B { //! Work with the value without copying it blk(get_ref(future)) @@ -179,16 +168,15 @@ proto! future_pipe ( ) #[allow(non_implicitly_copyable_typarams)] -mod test { - #[legacy_exports]; +pub mod test { #[test] - fn test_from_value() { + pub fn test_from_value() { let f = from_value(~"snail"); assert get(&f) == ~"snail"; } #[test] - fn test_from_port() { + pub fn test_from_port() { let (po, ch) = future_pipe::init(); future_pipe::server::completed(ch, ~"whale"); let f = from_port(po); @@ -196,43 +184,43 @@ mod test { } #[test] - fn test_from_fn() { + pub fn test_from_fn() { let f = from_fn(|| ~"brail"); assert get(&f) == ~"brail"; } #[test] - fn test_interface_get() { + pub fn test_interface_get() { let f = from_value(~"fail"); assert f.get() == ~"fail"; } #[test] - fn test_with() { + pub fn test_with() { let f = from_value(~"nail"); assert with(&f, |v| copy *v) == ~"nail"; } #[test] - fn test_get_ref_method() { + pub fn test_get_ref_method() { let f = from_value(22); assert *f.get_ref() == 22; } #[test] - fn test_get_ref_fn() { + pub fn test_get_ref_fn() { let f = from_value(22); assert *get_ref(&f) == 22; } #[test] - fn test_interface_with() { + pub fn test_interface_with() { let f = from_value(~"kale"); assert f.with(|v| copy *v) == ~"kale"; } #[test] - fn test_spawn() { + pub fn test_spawn() { let f = spawn(|| ~"bale"); assert get(&f) == ~"bale"; } @@ -240,13 +228,13 @@ mod test { #[test] #[should_fail] #[ignore(cfg(target_os = "win32"))] - fn test_futurefail() { + pub fn test_futurefail() { let f = spawn(|| fail); let _x: ~str = get(&f); } #[test] - fn test_sendable_future() { + pub fn test_sendable_future() { let expected = ~"schlorf"; let f = do spawn |copy expected| { copy expected }; do task::spawn { diff --git a/src/libcore/gc.rs b/src/libcore/gc.rs index 4faffb0c9ad..a60dbe5e03a 100644 --- a/src/libcore/gc.rs +++ b/src/libcore/gc.rs @@ -34,10 +34,6 @@ use libc::size_t; use libc::uintptr_t; use send_map::linear::LinearMap; -export Word; -export gc; -export cleanup_stack_for_failure; - // Mirrors rust_stack.h stk_seg struct StackSegment { prev: *StackSegment, @@ -268,7 +264,7 @@ unsafe fn walk_gc_roots(mem: Memory, sentinel: **Word, visitor: Visitor) { } } -fn gc() { +pub fn gc() { unsafe { // Abort when GC is disabled. if get_safe_point_count() == 0 { @@ -301,7 +297,7 @@ fn expect_sentinel() -> bool { false } // This should only be called from fail, as it will drop the roots // which are *live* on the stack, rather than dropping those that are // dead. -fn cleanup_stack_for_failure() { +pub fn cleanup_stack_for_failure() { unsafe { // Abort when GC is disabled. if get_safe_point_count() == 0 { diff --git a/src/libcore/hash.rs b/src/libcore/hash.rs index abc72ddfd31..6703006650b 100644 --- a/src/libcore/hash.rs +++ b/src/libcore/hash.rs @@ -17,9 +17,6 @@ use io::Writer; use io::WriterUtil; use to_bytes::IterBytes; -export Streaming, State, Hash, HashUtil; -export default_state; - /** * Types that can meaningfully be hashed should implement this. * @@ -32,7 +29,7 @@ export default_state; * the rest. This is the recommended approach, since constructing * good keyed hash functions is quite difficult. */ -trait Hash { +pub trait Hash { /** * Compute a "keyed" hash of the value implementing the trait, * taking `k0` and `k1` as "keying" parameters that randomize or @@ -49,7 +46,7 @@ trait Hash { } // When we have default methods, won't need this. -trait HashUtil { +pub trait HashUtil { pure fn hash() -> u64; } @@ -59,7 +56,7 @@ impl A: HashUtil { } /// Streaming hash-functions should implement this. -trait Streaming { +pub trait Streaming { fn input((&[const u8])); // These can be refactored some when we have default methods. fn result_bytes() -> ~[u8]; @@ -139,15 +136,15 @@ pure fn hash_keyed_5 State { +pub fn State(k0: u64, k1: u64) -> State { SipState(k0, k1) } #[inline(always)] -fn default_state() -> State { +pub fn default_state() -> State { State(0,0) } @@ -361,7 +358,7 @@ impl &SipState : Streaming { } #[test] -fn test_siphash() { +pub fn test_siphash() { let vecs : [[u8]/8]/64 = [ [ 0x31, 0x0e, 0x0e, 0xdd, 0x47, 0xdb, 0x6f, 0x72, ]/_, [ 0xfd, 0x67, 0xdc, 0x93, 0xc5, 0x39, 0xf8, 0x74, ]/_, @@ -468,26 +465,26 @@ fn test_siphash() { } #[test] #[cfg(target_arch = "arm")] -fn test_hash_uint() { +pub fn test_hash_uint() { let val = 0xdeadbeef_deadbeef_u64; assert (val as u64).hash() != (val as uint).hash(); assert (val as u32).hash() == (val as uint).hash(); } #[test] #[cfg(target_arch = "x86_64")] -fn test_hash_uint() { +pub fn test_hash_uint() { let val = 0xdeadbeef_deadbeef_u64; assert (val as u64).hash() == (val as uint).hash(); assert (val as u32).hash() != (val as uint).hash(); } #[test] #[cfg(target_arch = "x86")] -fn test_hash_uint() { +pub fn test_hash_uint() { let val = 0xdeadbeef_deadbeef_u64; assert (val as u64).hash() != (val as uint).hash(); assert (val as u32).hash() == (val as uint).hash(); } #[test] -fn test_hash_idempotent() { +pub fn test_hash_idempotent() { let val64 = 0xdeadbeef_deadbeef_u64; val64.hash() == val64.hash(); let val32 = 0xdeadbeef_u32; @@ -495,7 +492,7 @@ fn test_hash_idempotent() { } #[test] -fn test_hash_no_bytes_dropped_64() { +pub fn test_hash_no_bytes_dropped_64() { let val = 0xdeadbeef_deadbeef_u64; assert val.hash() != zero_byte(val, 0).hash(); @@ -514,7 +511,7 @@ fn test_hash_no_bytes_dropped_64() { } #[test] -fn test_hash_no_bytes_dropped_32() { +pub fn test_hash_no_bytes_dropped_32() { let val = 0xdeadbeef_u32; assert val.hash() != zero_byte(val, 0).hash(); diff --git a/src/libcore/iter-trait.rs b/src/libcore/iter-trait.rs index fe42fe9e36c..4cf2002adaa 100644 --- a/src/libcore/iter-trait.rs +++ b/src/libcore/iter-trait.rs @@ -6,7 +6,6 @@ use cmp::{Eq, Ord}; use inst::{IMPL_T, EACH, SIZE_HINT}; -export extensions; impl IMPL_T: iter::BaseIter { pure fn each(blk: fn(v: &A) -> bool) { EACH(&self, blk) } diff --git a/src/libcore/mutable.rs b/src/libcore/mutable.rs index 506da9d3909..65907cc1827 100644 --- a/src/libcore/mutable.rs +++ b/src/libcore/mutable.rs @@ -15,8 +15,6 @@ mutation when the data structure should be immutable. use util::with; use cast::transmute_immut; -export Mut; - enum Mode { ReadOnly, Mutable, Immutable } struct Data { @@ -24,13 +22,13 @@ struct Data { priv mut mode: Mode } -type Mut = Data; +pub type Mut = Data; -fn Mut(+t: T) -> Mut { +pub fn Mut(+t: T) -> Mut { Data {value: t, mode: ReadOnly} } -fn unwrap(+m: Mut) -> T { +pub fn unwrap(+m: Mut) -> T { // Borrowck should prevent us from calling unwrap while the value // is in use, as that would be a move from a borrowed value. assert (m.mode as uint) == (ReadOnly as uint); @@ -71,7 +69,7 @@ impl Data { #[test] #[ignore(cfg(windows))] #[should_fail] -fn test_mut_in_imm() { +pub fn test_mut_in_imm() { let m = @Mut(1); do m.borrow_imm |_p| { do m.borrow_mut |_q| { @@ -83,7 +81,7 @@ fn test_mut_in_imm() { #[test] #[ignore(cfg(windows))] #[should_fail] -fn test_imm_in_mut() { +pub fn test_imm_in_mut() { let m = @Mut(1); do m.borrow_mut |_p| { do m.borrow_imm |_q| { @@ -93,7 +91,7 @@ fn test_imm_in_mut() { } #[test] -fn test_const_in_mut() { +pub fn test_const_in_mut() { let m = @Mut(1); do m.borrow_mut |p| { do m.borrow_const |q| { @@ -105,7 +103,7 @@ fn test_const_in_mut() { } #[test] -fn test_mut_in_const() { +pub fn test_mut_in_const() { let m = @Mut(1); do m.borrow_const |p| { do m.borrow_mut |q| { @@ -117,7 +115,7 @@ fn test_mut_in_const() { } #[test] -fn test_imm_in_const() { +pub fn test_imm_in_const() { let m = @Mut(1); do m.borrow_const |p| { do m.borrow_imm |q| { @@ -127,7 +125,7 @@ fn test_imm_in_const() { } #[test] -fn test_const_in_imm() { +pub fn test_const_in_imm() { let m = @Mut(1); do m.borrow_imm |p| { do m.borrow_const |q| { @@ -140,7 +138,7 @@ fn test_const_in_imm() { #[test] #[ignore(cfg(windows))] #[should_fail] -fn test_mut_in_imm_in_const() { +pub fn test_mut_in_imm_in_const() { let m = @Mut(1); do m.borrow_const |_p| { do m.borrow_imm |_q| { @@ -149,3 +147,4 @@ fn test_mut_in_imm_in_const() { } } } + diff --git a/src/libcore/private.rs b/src/libcore/private.rs index 9fe05723d35..4021ad5e88f 100644 --- a/src/libcore/private.rs +++ b/src/libcore/private.rs @@ -4,13 +4,6 @@ #[doc(hidden)]; -export chan_from_global_ptr, weaken_task; - -export SharedMutableState, shared_mutable_state, clone_shared_mutable_state; -export get_shared_mutable_state, get_shared_immutable_state; -export unwrap_shared_mutable_state; -export Exclusive, exclusive, unwrap_exclusive; - use compare_and_swap = rustrt::rust_compare_and_swap_ptr; use task::TaskBuilder; use task::atomically; @@ -49,7 +42,7 @@ type GlobalPtr = *libc::uintptr_t; * or, if no channel exists creates and installs a new channel and sets up a * new task to receive from it. */ -unsafe fn chan_from_global_ptr( +pub unsafe fn chan_from_global_ptr( global: GlobalPtr, task_fn: fn() -> task::TaskBuilder, +f: fn~(comm::Port) @@ -110,7 +103,7 @@ unsafe fn chan_from_global_ptr( } #[test] -fn test_from_global_chan1() { +pub fn test_from_global_chan1() { // This is unreadable, right? @@ -147,7 +140,7 @@ fn test_from_global_chan1() { } #[test] -fn test_from_global_chan2() { +pub fn test_from_global_chan2() { for iter::repeat(100u) { // The global channel @@ -208,7 +201,7 @@ fn test_from_global_chan2() { * * Weak tasks must not be supervised. A supervised task keeps * a reference to its parent, so the parent will not die. */ -unsafe fn weaken_task(f: fn(comm::Port<()>)) { +pub unsafe fn weaken_task(f: fn(comm::Port<()>)) { let po = comm::Port(); let ch = comm::Chan(po); unsafe { @@ -232,7 +225,7 @@ unsafe fn weaken_task(f: fn(comm::Port<()>)) { } #[test] -fn test_weaken_task_then_unweaken() { +pub fn test_weaken_task_then_unweaken() { do task::try { unsafe { do weaken_task |_po| { @@ -242,7 +235,7 @@ fn test_weaken_task_then_unweaken() { } #[test] -fn test_weaken_task_wait() { +pub fn test_weaken_task_wait() { do task::spawn_unlinked { unsafe { do weaken_task |po| { @@ -253,7 +246,7 @@ fn test_weaken_task_wait() { } #[test] -fn test_weaken_task_stress() { +pub fn test_weaken_task_stress() { // Create a bunch of weak tasks for iter::repeat(100u) { do task::spawn { @@ -275,7 +268,7 @@ fn test_weaken_task_stress() { #[test] #[ignore(cfg(windows))] -fn test_weaken_task_fail() { +pub fn test_weaken_task_fail() { let res = do task::try { unsafe { do weaken_task |_po| { @@ -347,7 +340,7 @@ fn ArcDestruct(data: *libc::c_void) -> ArcDestruct { } } -unsafe fn unwrap_shared_mutable_state(+rc: SharedMutableState) +pub unsafe fn unwrap_shared_mutable_state(+rc: SharedMutableState) -> T { struct DeathThroes { mut ptr: Option<~ArcData>, @@ -418,9 +411,10 @@ unsafe fn unwrap_shared_mutable_state(+rc: SharedMutableState) * Data races between tasks can result in crashes and, with sufficient * cleverness, arbitrary type coercion. */ -type SharedMutableState = ArcDestruct; +pub type SharedMutableState = ArcDestruct; -unsafe fn shared_mutable_state(+data: T) -> SharedMutableState { +pub unsafe fn shared_mutable_state(+data: T) -> + SharedMutableState { let data = ~ArcData { count: 1, unwrapper: 0, data: Some(move data) }; unsafe { let ptr = cast::transmute(move data); @@ -429,7 +423,7 @@ unsafe fn shared_mutable_state(+data: T) -> SharedMutableState { } #[inline(always)] -unsafe fn get_shared_mutable_state(rc: &a/SharedMutableState) +pub unsafe fn get_shared_mutable_state(rc: &a/SharedMutableState) -> &a/mut T { unsafe { let ptr: ~ArcData = cast::reinterpret_cast(&(*rc).data); @@ -441,8 +435,8 @@ unsafe fn get_shared_mutable_state(rc: &a/SharedMutableState) } } #[inline(always)] -unsafe fn get_shared_immutable_state(rc: &a/SharedMutableState) - -> &a/T { +pub unsafe fn get_shared_immutable_state( + rc: &a/SharedMutableState) -> &a/T { unsafe { let ptr: ~ArcData = cast::reinterpret_cast(&(*rc).data); assert ptr.count > 0; @@ -453,7 +447,7 @@ unsafe fn get_shared_immutable_state(rc: &a/SharedMutableState) } } -unsafe fn clone_shared_mutable_state(rc: &SharedMutableState) +pub unsafe fn clone_shared_mutable_state(rc: &SharedMutableState) -> SharedMutableState { unsafe { let ptr: ~ArcData = cast::reinterpret_cast(&(*rc).data); @@ -506,9 +500,9 @@ struct ExData { lock: LittleLock, mut failed: bool, mut data: T, } /** * An arc over mutable data that is protected by a lock. For library use only. */ -struct Exclusive { x: SharedMutableState> } +pub struct Exclusive { x: SharedMutableState> } -fn exclusive(+user_data: T) -> Exclusive { +pub fn exclusive(+user_data: T) -> Exclusive { let data = ExData { lock: LittleLock(), mut failed: false, mut data: user_data }; @@ -550,7 +544,7 @@ impl Exclusive { } // FIXME(#2585) make this a by-move method on the exclusive -fn unwrap_exclusive(+arc: Exclusive) -> T { +pub fn unwrap_exclusive(+arc: Exclusive) -> T { let Exclusive { x: x } <- arc; let inner = unsafe { unwrap_shared_mutable_state(move x) }; let ExData { data: data, _ } <- inner; @@ -558,11 +552,9 @@ fn unwrap_exclusive(+arc: Exclusive) -> T { } #[cfg(test)] -mod tests { - #[legacy_exports]; - +pub mod tests { #[test] - fn exclusive_arc() { + pub fn exclusive_arc() { let mut futures = ~[]; let num_tasks = 10u; @@ -589,7 +581,7 @@ mod tests { } #[test] #[should_fail] #[ignore(cfg(windows))] - fn exclusive_poison() { + pub fn exclusive_poison() { // Tests that if one task fails inside of an exclusive, subsequent // accesses will also fail. let x = exclusive(1); @@ -605,13 +597,13 @@ mod tests { } #[test] - fn exclusive_unwrap_basic() { + pub fn exclusive_unwrap_basic() { let x = exclusive(~~"hello"); assert unwrap_exclusive(x) == ~~"hello"; } #[test] - fn exclusive_unwrap_contended() { + pub fn exclusive_unwrap_contended() { let x = exclusive(~~"hello"); let x2 = ~mut Some(x.clone()); do task::spawn { @@ -636,7 +628,7 @@ mod tests { } #[test] #[should_fail] #[ignore(cfg(windows))] - fn exclusive_unwrap_conflict() { + pub fn exclusive_unwrap_conflict() { let x = exclusive(~~"hello"); let x2 = ~mut Some(x.clone()); let mut res = None; @@ -650,7 +642,7 @@ mod tests { } #[test] #[ignore(cfg(windows))] - fn exclusive_unwrap_deadlock() { + pub fn exclusive_unwrap_deadlock() { // This is not guaranteed to get to the deadlock before being killed, // but it will show up sometimes, and if the deadlock were not there, // the test would nondeterministically fail.