diff --git a/src/libcore/io.rs b/src/libcore/io.rs index 570df08e77c..424620271a2 100644 --- a/src/libcore/io.rs +++ b/src/libcore/io.rs @@ -1123,7 +1123,7 @@ mod tests { log(debug, tmpfile); let frood: ~str = ~"A hoopy frood who really knows where his towel is."; - log(debug, frood); + log(debug, copy frood); { let out: io::Writer = result::get( @@ -1132,7 +1132,7 @@ mod tests { } let inp: io::Reader = result::get(&io::file_reader(tmpfile)); let frood2: ~str = inp.read_c_str(); - log(debug, frood2); + log(debug, copy frood2); assert frood == frood2; } diff --git a/src/libcore/os.rs b/src/libcore/os.rs index ea97b3ce026..e793155c267 100644 --- a/src/libcore/os.rs +++ b/src/libcore/os.rs @@ -946,7 +946,7 @@ mod tests { while i < 100 { s += ~"aaaaaaaaaa"; i += 1; } let n = make_rand_name(); setenv(n, s); - log(debug, s); + log(debug, copy s); assert getenv(n) == option::Some(move s); } @@ -955,7 +955,7 @@ mod tests { let path = os::self_exe_path(); assert path.is_some(); let path = path.get(); - log(debug, path); + log(debug, copy path); // Hard to test this function assert path.is_absolute; diff --git a/src/libcore/run.rs b/src/libcore/run.rs index 7afcb4f3c99..298848b6e58 100644 --- a/src/libcore/run.rs +++ b/src/libcore/run.rs @@ -440,8 +440,8 @@ mod tests { readclose(pipe_err.in); os::waitpid(pid); - log(debug, expected); - log(debug, actual); + log(debug, copy expected); + log(debug, copy actual); assert (expected == actual); } diff --git a/src/test/run-pass/alt-implicit-copy-unique.rs b/src/test/run-pass/alt-implicit-copy-unique.rs index eca726e8277..502df31ad17 100644 --- a/src/test/run-pass/alt-implicit-copy-unique.rs +++ b/src/test/run-pass/alt-implicit-copy-unique.rs @@ -1,6 +1,6 @@ fn main() { let x = ~{mut a: ~10, b: ~20}; match x { - ~{a, b} => { assert *a == 10; (*x).a = ~30; assert *a == 30; } + ~{ref a, ref b} => { assert **a == 10; (*x).a = ~30; assert **a == 30; } } } diff --git a/src/test/run-pass/block-iter-2.rs b/src/test/run-pass/block-iter-2.rs index 6389ef0f644..e15dcf5f903 100644 --- a/src/test/run-pass/block-iter-2.rs +++ b/src/test/run-pass/block-iter-2.rs @@ -6,8 +6,8 @@ fn iter_vec(v: ~[T], f: fn(T)) { for v.each |x| { f(*x); } } fn main() { let v = ~[1, 2, 3, 4, 5]; let mut sum = 0; - iter_vec(v, |i| { - iter_vec(v, |j| { + iter_vec(copy v, |i| { + iter_vec(copy v, |j| { log(error, i * j); sum += i * j; }); diff --git a/src/test/run-pass/block-vec-map2.rs b/src/test/run-pass/block-vec-map2.rs index d270800de11..7ab8ccb0b5b 100644 --- a/src/test/run-pass/block-vec-map2.rs +++ b/src/test/run-pass/block-vec-map2.rs @@ -5,6 +5,6 @@ fn main() { vec::map2(~[1, 2, 3, 4, 5], ~[true, false, false, true, true], |i, b| if *b { -(*i) } else { *i } ); - log(error, v); + log(error, copy v); assert (v == ~[-1, 2, 3, -4, -5]); } diff --git a/src/test/run-pass/class-cast-to-trait-multiple-types.rs b/src/test/run-pass/class-cast-to-trait-multiple-types.rs index f0581c2df8c..4c5d944fed1 100644 --- a/src/test/run-pass/class-cast-to-trait-multiple-types.rs +++ b/src/test/run-pass/class-cast-to-trait-multiple-types.rs @@ -76,8 +76,8 @@ fn annoy_neighbors(critter: T) { fn main() { let nyan : cat = cat(0u, 2, ~"nyan"); let whitefang : dog = dog(); - annoy_neighbors(nyan as noisy); - annoy_neighbors(whitefang as noisy); + annoy_neighbors((copy nyan) as noisy); + annoy_neighbors((copy whitefang) as noisy); assert(nyan.meow_count() == 10u); assert(*whitefang.volume == 1); -} \ No newline at end of file +} diff --git a/src/test/run-pass/class-implement-traits.rs b/src/test/run-pass/class-implement-traits.rs index 396dbc5ae81..b91119643b7 100644 --- a/src/test/run-pass/class-implement-traits.rs +++ b/src/test/run-pass/class-implement-traits.rs @@ -44,7 +44,7 @@ fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat { cat { meows: in_x, how_hungry: in_y, - name: in_name + name: copy in_name } } diff --git a/src/test/run-pass/explicit-self.rs b/src/test/run-pass/explicit-self.rs index f72005a54f0..479a9d51ca0 100644 --- a/src/test/run-pass/explicit-self.rs +++ b/src/test/run-pass/explicit-self.rs @@ -60,7 +60,7 @@ fn main() { assert x.quux() == 10; let y = ~thing({mut a: @10}); - assert y.bar() == 10; + assert (copy y).bar() == 10; assert y.quux() == 10; let z = thing({mut a: @11}); diff --git a/src/test/run-pass/expr-alt-generic-unique1.rs b/src/test/run-pass/expr-alt-generic-unique1.rs index 264f03ee2c3..13ed25c9995 100644 --- a/src/test/run-pass/expr-alt-generic-unique1.rs +++ b/src/test/run-pass/expr-alt-generic-unique1.rs @@ -4,7 +4,10 @@ type compare = fn@(~T, ~T) -> bool; fn test_generic(expected: ~T, eq: compare) { - let actual: ~T = match true { true => { expected }, _ => fail ~"wat" }; + let actual: ~T = match true { + true => { copy expected }, + _ => fail ~"wat" + }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-alt-generic-unique2.rs b/src/test/run-pass/expr-alt-generic-unique2.rs index 47ea3cecd6d..e865bd25208 100644 --- a/src/test/run-pass/expr-alt-generic-unique2.rs +++ b/src/test/run-pass/expr-alt-generic-unique2.rs @@ -6,7 +6,10 @@ type compare = fn@(T, T) -> bool; fn test_generic(expected: T, eq: compare) { - let actual: T = match true { true => expected, _ => fail ~"wat" }; + let actual: T = match true { + true => copy expected, + _ => fail ~"wat" + }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-block-generic-unique1.rs b/src/test/run-pass/expr-block-generic-unique1.rs index 0ccabb2c081..b7af8366c7d 100644 --- a/src/test/run-pass/expr-block-generic-unique1.rs +++ b/src/test/run-pass/expr-block-generic-unique1.rs @@ -4,7 +4,7 @@ type compare = fn@(~T, ~T) -> bool; fn test_generic(expected: ~T, eq: compare) { - let actual: ~T = { expected }; + let actual: ~T = { copy expected }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/generic-alias-unique.rs b/src/test/run-pass/generic-alias-unique.rs index 9d3ac09de7c..05b18e8c651 100644 --- a/src/test/run-pass/generic-alias-unique.rs +++ b/src/test/run-pass/generic-alias-unique.rs @@ -4,7 +4,7 @@ fn id(t: T) -> T { return t; } fn main() { let expected = ~100; - let actual = id::<~int>(expected); + let actual = id::<~int>(copy expected); log(debug, *actual); assert (*expected == *actual); } diff --git a/src/test/run-pass/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs index 50b88693f39..a14df1608f3 100644 --- a/src/test/run-pass/hashmap-memory.rs +++ b/src/test/run-pass/hashmap-memory.rs @@ -42,7 +42,7 @@ mod map_reduce { fn emit(im: map::HashMap<~str, int>, ctrl: Chan, key: ~str, val: ~str) { let mut c; - match im.find(key) { + match im.find(copy key) { Some(_c) => { c = _c } None => { let p = Port(); @@ -70,7 +70,7 @@ mod map_reduce { reducers = map::HashMap(); - start_mappers(Chan(&ctrl), inputs); + start_mappers(Chan(&ctrl), copy inputs); let mut num_mappers = vec::len(inputs) as int; diff --git a/src/test/run-pass/issue-2718.rs b/src/test/run-pass/issue-2718.rs index 82ad82c64a3..d5c6e6bb6d2 100644 --- a/src/test/run-pass/issue-2718.rs +++ b/src/test/run-pass/issue-2718.rs @@ -207,8 +207,8 @@ mod pingpong { enum pong = pipes::send_packet; fn liberate_ping(-p: ping) -> pipes::send_packet unsafe { - let addr : *pipes::send_packet = match p { - ping(x) => { cast::transmute(ptr::addr_of(&x)) } + let addr : *pipes::send_packet = match &p { + &ping(x) => { cast::transmute(ptr::addr_of(&x)) } }; let liberated_value = move *addr; cast::forget(move p); @@ -216,8 +216,8 @@ mod pingpong { } fn liberate_pong(-p: pong) -> pipes::send_packet unsafe { - let addr : *pipes::send_packet = match p { - pong(x) => { cast::transmute(ptr::addr_of(&x)) } + let addr : *pipes::send_packet = match &p { + &pong(x) => { cast::transmute(ptr::addr_of(&x)) } }; let liberated_value = move *addr; cast::forget(move p); diff --git a/src/test/run-pass/issue-2804.rs b/src/test/run-pass/issue-2804.rs index 7ef4ef22560..867c023ccf1 100644 --- a/src/test/run-pass/issue-2804.rs +++ b/src/test/run-pass/issue-2804.rs @@ -31,9 +31,9 @@ fn lookup(table: ~json::Object, key: ~str, default: ~str) -> ~str fn add_interface(store: int, managed_ip: ~str, data: std::json::Json) -> (~str, object) { - match data + match &data { - std::json::Object(interface) => + &std::json::Object(interface) => { let name = lookup(interface, ~"ifDescr", ~""); let label = fmt!("%s-%s", managed_ip, name);