diff --git a/src/libcore/flate.rs b/src/libcore/flate.rs index 22d31f54e2b..530cf66b55a 100644 --- a/src/libcore/flate.rs +++ b/src/libcore/flate.rs @@ -55,6 +55,7 @@ fn inflate_buf(buf: &[const u8]) -> ~[u8] { } #[test] +#[allow(non_implicitly_copyable_typarams)] fn test_flate_round_trip() { let r = rand::Rng(); let mut words = ~[]; diff --git a/src/libcore/future.rs b/src/libcore/future.rs index e176b2544d4..6b0204e6b2b 100644 --- a/src/libcore/future.rs +++ b/src/libcore/future.rs @@ -174,66 +174,69 @@ proto! future_pipe ( } ) -#[test] -fn test_from_value() { - let f = from_value(~"snail"); - assert get(&f) == ~"snail"; -} +#[allow(non_implicitly_copyable_typarams)] +mod test { + #[test] + fn test_from_value() { + let f = from_value(~"snail"); + assert get(&f) == ~"snail"; + } -#[test] -fn test_from_port() { - let (po, ch) = future_pipe::init(); - future_pipe::server::completed(ch, ~"whale"); - let f = from_port(po); - assert get(&f) == ~"whale"; -} + #[test] + fn test_from_port() { + let (po, ch) = future_pipe::init(); + future_pipe::server::completed(ch, ~"whale"); + let f = from_port(po); + assert get(&f) == ~"whale"; + } -#[test] -fn test_from_fn() { - let f = from_fn(|| ~"brail"); - assert get(&f) == ~"brail"; -} + #[test] + fn test_from_fn() { + let f = from_fn(|| ~"brail"); + assert get(&f) == ~"brail"; + } -#[test] -fn test_interface_get() { - let f = from_value(~"fail"); - assert f.get() == ~"fail"; -} + #[test] + fn test_interface_get() { + let f = from_value(~"fail"); + assert f.get() == ~"fail"; + } -#[test] -fn test_with() { - let f = from_value(~"nail"); - assert with(&f, |v| *v) == ~"nail"; -} + #[test] + fn test_with() { + let f = from_value(~"nail"); + assert with(&f, |v| copy *v) == ~"nail"; + } -#[test] -fn test_get_ref_method() { - let f = from_value(22); - assert *f.get_ref() == 22; -} + #[test] + fn test_get_ref_method() { + let f = from_value(22); + assert *f.get_ref() == 22; + } -#[test] -fn test_get_ref_fn() { - let f = from_value(22); - assert *get_ref(&f) == 22; -} + #[test] + fn test_get_ref_fn() { + let f = from_value(22); + assert *get_ref(&f) == 22; + } -#[test] -fn test_interface_with() { - let f = from_value(~"kale"); - assert f.with(|v| *v) == ~"kale"; -} + #[test] + fn test_interface_with() { + let f = from_value(~"kale"); + assert f.with(|v| copy *v) == ~"kale"; + } -#[test] -fn test_spawn() { - let f = spawn(|| ~"bale"); - assert get(&f) == ~"bale"; -} + #[test] + fn test_spawn() { + let f = spawn(|| ~"bale"); + assert get(&f) == ~"bale"; + } -#[test] -#[should_fail] -#[ignore(cfg(target_os = "win32"))] -fn test_futurefail() { - let f = spawn(|| fail); - let _x: ~str = get(&f); -} + #[test] + #[should_fail] + #[ignore(cfg(target_os = "win32"))] + fn test_futurefail() { + let f = spawn(|| fail); + let _x: ~str = get(&f); + } +} \ No newline at end of file diff --git a/src/libcore/os.rs b/src/libcore/os.rs index 2c5ad291167..5ce0a51fbf3 100644 --- a/src/libcore/os.rs +++ b/src/libcore/os.rs @@ -827,6 +827,7 @@ fn arch() -> ~str { ~"x86_64" } fn arch() -> str { ~"arm" } #[cfg(test)] +#[allow(non_implicitly_copyable_typarams)] mod tests { #[test] @@ -893,7 +894,7 @@ mod tests { let e = env(); assert vec::len(e) > 0u; for vec::each(e) |p| { - let (n, v) = p; + let (n, v) = copy p; log(debug, n); let v2 = getenv(n); // MingW seems to set some funky environment variables like @@ -909,7 +910,7 @@ mod tests { let mut e = env(); setenv(n, ~"VALUE"); - assert !vec::contains(e, (n, ~"VALUE")); + assert !vec::contains(e, (copy n, ~"VALUE")); e = env(); assert vec::contains(e, (n, ~"VALUE")); diff --git a/src/libcore/result.rs b/src/libcore/result.rs index ba8e7963133..4c86e154159 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -376,6 +376,7 @@ impl Result : Eq { } #[cfg(test)] +#[allow(non_implicitly_copyable_typarams)] mod tests { fn op1() -> result::Result { result::Ok(666) } diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 861a603e170..800b4a130e6 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -3099,7 +3099,7 @@ mod tests { 0x000a_u16 ]) ]; for vec::each(pairs) |p| { - let (s, u) = p; + let (s, u) = copy p; assert to_utf16(s) == u; assert from_utf16(u) == s; assert from_utf16(to_utf16(s)) == s; diff --git a/src/libcore/to_str.rs b/src/libcore/to_str.rs index 63e0f366c53..6303bbbf0e5 100644 --- a/src/libcore/to_str.rs +++ b/src/libcore/to_str.rs @@ -84,6 +84,7 @@ impl ~A: ToStr { } #[cfg(test)] +#[allow(non_implicitly_copyable_typarams)] mod tests { #[test] fn test_simple_types() { diff --git a/src/libcore/tuple.rs b/src/libcore/tuple.rs index d764f188be2..92a0f681a56 100644 --- a/src/libcore/tuple.rs +++ b/src/libcore/tuple.rs @@ -144,6 +144,7 @@ impl (A, B, C): Ord { } #[test] +#[allow(non_implicitly_copyable_typarams)] fn test_tuple() { assert (948, 4039.48).first() == 948; assert (34.5, ~"foo").second() == ~"foo"; diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index 0f99ec2a227..680eb1e2dcb 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -2381,19 +2381,19 @@ mod tests { let mut results: ~[~[int]]; results = ~[]; - permute(~[], |v| vec::push(results, v)); + permute(~[], |v| vec::push(results, copy v)); assert results == ~[~[]]; results = ~[]; - permute(~[7], |v| results += ~[v]); + permute(~[7], |v| results += ~[copy v]); assert results == ~[~[7]]; results = ~[]; - permute(~[1,1], |v| results += ~[v]); + permute(~[1,1], |v| results += ~[copy v]); assert results == ~[~[1,1],~[1,1]]; results = ~[]; - permute(~[5,2,0], |v| results += ~[v]); + permute(~[5,2,0], |v| results += ~[copy v]); assert results == ~[~[5,2,0],~[5,0,2],~[2,5,0],~[2,0,5],~[0,5,2],~[0,2,5]]; }