diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2012-12-05 16:51:32 -0800 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2012-12-05 16:51:32 -0800 |
| commit | 608403227075586dfe676916bdce6796eef3d9bb (patch) | |
| tree | d983a40fbd48318d97c2d88e381e920bcb85f663 /src | |
| parent | 7a065f243473ea4ea8dc4653bca33f04a1381122 (diff) | |
| download | rust-608403227075586dfe676916bdce6796eef3d9bb.tar.gz rust-608403227075586dfe676916bdce6796eef3d9bb.zip | |
test: More run-pass test fixes
Diffstat (limited to 'src')
29 files changed, 47 insertions, 45 deletions
diff --git a/src/test/auxiliary/cci_class_cast.rs b/src/test/auxiliary/cci_class_cast.rs index ca2af387587..32e0d87e850 100644 --- a/src/test/auxiliary/cci_class_cast.rs +++ b/src/test/auxiliary/cci_class_cast.rs @@ -13,7 +13,7 @@ struct cat { } impl cat : ToStr { - pure fn to_str() -> ~str { self.name } + pure fn to_str() -> ~str { copy self.name } } priv impl cat { diff --git a/src/test/auxiliary/issue-2631-a.rs b/src/test/auxiliary/issue-2631-a.rs index 0ede9fb3f19..ad49866c005 100644 --- a/src/test/auxiliary/issue-2631-a.rs +++ b/src/test/auxiliary/issue-2631-a.rs @@ -12,5 +12,5 @@ type header_map = HashMap<~str, @DVec<@~str>>; // the unused ty param is necessary so this gets monomorphized fn request<T: Copy>(req: header_map) { - let _x = *(*req.get(~"METHOD"))[0u]; + let _x = *(copy *req.get(~"METHOD"))[0u]; } diff --git a/src/test/auxiliary/issue_2242_a.rs b/src/test/auxiliary/issue_2242_a.rs index ac7a8e47f26..a03deaadf57 100644 --- a/src/test/auxiliary/issue_2242_a.rs +++ b/src/test/auxiliary/issue_2242_a.rs @@ -6,5 +6,5 @@ trait to_strz { } impl ~str: to_strz { - fn to_strz() -> ~str { self } + fn to_strz() -> ~str { copy self } } diff --git a/src/test/auxiliary/trait_inheritance_overloading_xc.rs b/src/test/auxiliary/trait_inheritance_overloading_xc.rs index ceeee89de6a..2c8cc190dbc 100644 --- a/src/test/auxiliary/trait_inheritance_overloading_xc.rs +++ b/src/test/auxiliary/trait_inheritance_overloading_xc.rs @@ -8,7 +8,7 @@ pub struct MyInt { } pub impl MyInt : Add<MyInt, MyInt> { - pure fn add(other: &MyInt) -> MyInt { mi(self.val + other.val) } + pure fn add(&self, other: &MyInt) -> MyInt { mi(self.val + other.val) } } pub impl MyInt : Sub<MyInt, MyInt> { diff --git a/src/test/run-pass/alt-implicit-copy-unique.rs b/src/test/run-pass/alt-implicit-copy-unique.rs index 502df31ad17..a2fb1678aa5 100644 --- a/src/test/run-pass/alt-implicit-copy-unique.rs +++ b/src/test/run-pass/alt-implicit-copy-unique.rs @@ -1,6 +1,8 @@ fn main() { let x = ~{mut a: ~10, b: ~20}; match x { - ~{ref a, ref b} => { assert **a == 10; (*x).a = ~30; assert **a == 30; } + ~{a: ref a, b: ref b} => { + assert **a == 10; (*x).a = ~30; assert **a == 30; + } } } diff --git a/src/test/run-pass/getopts_ref.rs b/src/test/run-pass/getopts_ref.rs index 48bc054ad37..8ec7e06bd3e 100644 --- a/src/test/run-pass/getopts_ref.rs +++ b/src/test/run-pass/getopts_ref.rs @@ -9,7 +9,7 @@ fn main() { match getopts(args, opts) { result::Ok(ref m) => assert !opt_present(m, "b"), - result::Err(f) => fail fail_str(f) + result::Err(ref f) => fail fail_str(*f) }; -} \ No newline at end of file +} diff --git a/src/test/run-pass/issue-2633-2.rs b/src/test/run-pass/issue-2633-2.rs index 1ff294a2d30..b6adfd1602f 100644 --- a/src/test/run-pass/issue-2633-2.rs +++ b/src/test/run-pass/issue-2633-2.rs @@ -4,5 +4,5 @@ fn a_val(&&x: ~int, +y: ~int) -> int { fn main() { let z = ~22; - a_val(z, z); + a_val(copy z, copy z); } diff --git a/src/test/run-pass/issue-2633.rs b/src/test/run-pass/issue-2633.rs index e0955575d60..a829676675d 100644 --- a/src/test/run-pass/issue-2633.rs +++ b/src/test/run-pass/issue-2633.rs @@ -17,5 +17,5 @@ fn nyan(kitty: cat, _kitty_info: kitty_info) { fn main() { let mut kitty = cat(); - nyan(kitty, {kitty: kitty}); + nyan(copy kitty, {kitty: copy kitty}); } diff --git a/src/test/run-pass/issue-2804.rs b/src/test/run-pass/issue-2804.rs index 867c023ccf1..d4d5e6d9d72 100644 --- a/src/test/run-pass/issue-2804.rs +++ b/src/test/run-pass/issue-2804.rs @@ -13,9 +13,9 @@ fn lookup(table: ~json::Object, key: ~str, default: ~str) -> ~str { match table.find(&key) { - option::Some(std::json::String(s)) => + option::Some(std::json::String(copy s)) => { - s + copy s } option::Some(value) => { @@ -33,9 +33,9 @@ fn add_interface(store: int, managed_ip: ~str, data: std::json::Json) -> (~str, { match &data { - &std::json::Object(interface) => + &std::json::Object(copy interface) => { - let name = lookup(interface, ~"ifDescr", ~""); + let name = lookup(copy interface, ~"ifDescr", ~""); let label = fmt!("%s-%s", managed_ip, name); (label, bool_value(false)) diff --git a/src/test/run-pass/istr.rs b/src/test/run-pass/istr.rs index c9e1c2886ea..e48a08cdf36 100644 --- a/src/test/run-pass/istr.rs +++ b/src/test/run-pass/istr.rs @@ -1,6 +1,6 @@ fn test_stack_assign() { let s: ~str = ~"a"; - log(debug, s); + log(debug, copy s); let t: ~str = ~"a"; assert (s == t); let u: ~str = ~"b"; @@ -39,7 +39,7 @@ fn test_append() { let mut s = ~"a"; s += ~"b"; - log(debug, s); + log(debug, copy s); assert (s == ~"ab"); let mut s = ~"c"; diff --git a/src/test/run-pass/last-use-corner-cases.rs b/src/test/run-pass/last-use-corner-cases.rs index 510fc8ddeaa..c420ffac684 100644 --- a/src/test/run-pass/last-use-corner-cases.rs +++ b/src/test/run-pass/last-use-corner-cases.rs @@ -21,7 +21,7 @@ fn main() { // Check that no false positives are found in loops. let mut q = ~40, p = 10; loop { - let i = q; + let i = copy q; p += *i; if p > 100 { break; } } diff --git a/src/test/run-pass/last-use-in-cap-clause.rs b/src/test/run-pass/last-use-in-cap-clause.rs index baa03abeeb9..9fa814dd5cb 100644 --- a/src/test/run-pass/last-use-in-cap-clause.rs +++ b/src/test/run-pass/last-use-in-cap-clause.rs @@ -2,7 +2,7 @@ fn foo() -> fn@() -> int { let k = ~22; - let _u = {a: k}; + let _u = {a: copy k}; return fn@(move k) -> int { 22 }; } diff --git a/src/test/run-pass/last-use-is-capture.rs b/src/test/run-pass/last-use-is-capture.rs index 8dcb2f2cf85..ba49a5fd578 100644 --- a/src/test/run-pass/last-use-is-capture.rs +++ b/src/test/run-pass/last-use-is-capture.rs @@ -3,6 +3,6 @@ fn main() { fn invoke(f: fn@()) { f(); } let k = ~22; - let _u = {a: k}; + let _u = {a: copy k}; invoke(|| log(error, k) ) } diff --git a/src/test/run-pass/morestack6.rs b/src/test/run-pass/morestack6.rs index 0d44e264688..14acb23b892 100644 --- a/src/test/run-pass/morestack6.rs +++ b/src/test/run-pass/morestack6.rs @@ -30,7 +30,7 @@ fn runtest2(f: fn~(), frame_backoff: u32, last_stk: *u8) -> u32 { // We switched stacks, go back and try to hit the dynamic linker frame_backoff } else { - let frame_backoff = runtest2(f, frame_backoff, curr_stk); + let frame_backoff = runtest2(copy f, frame_backoff, curr_stk); if frame_backoff > 1u32 { frame_backoff - 1u32 } else if frame_backoff == 1u32 { diff --git a/src/test/run-pass/newtype-polymorphic.rs b/src/test/run-pass/newtype-polymorphic.rs index 18f6557fdac..4590542e3e8 100644 --- a/src/test/run-pass/newtype-polymorphic.rs +++ b/src/test/run-pass/newtype-polymorphic.rs @@ -1,6 +1,6 @@ enum myvec<X> = ~[X]; -fn myvec_deref<X: Copy>(mv: myvec<X>) -> ~[X] { return *mv; } +fn myvec_deref<X: Copy>(mv: myvec<X>) -> ~[X] { return copy *mv; } fn myvec_elt<X: Copy>(mv: myvec<X>) -> X { return mv[0]; } diff --git a/src/test/run-pass/operator-overloading.rs b/src/test/run-pass/operator-overloading.rs index 91d4a13a829..9bdc137b291 100644 --- a/src/test/run-pass/operator-overloading.rs +++ b/src/test/run-pass/operator-overloading.rs @@ -7,7 +7,7 @@ struct Point { } impl Point : ops::Add<Point,Point> { - pure fn add(other: &Point) -> Point { + pure fn add(&self, other: &Point) -> Point { Point {x: self.x + (*other).x, y: self.y + (*other).y} } } diff --git a/src/test/run-pass/rec-auto.rs b/src/test/run-pass/rec-auto.rs index 0bb521c9dfb..8b409e244f0 100644 --- a/src/test/run-pass/rec-auto.rs +++ b/src/test/run-pass/rec-auto.rs @@ -6,6 +6,6 @@ // Issue #50. fn main() { let x = {foo: ~"hello", bar: ~"world"}; - log(debug, x.foo); - log(debug, x.bar); + log(debug, copy x.foo); + log(debug, copy x.bar); } diff --git a/src/test/run-pass/ret-break-cont-in-block.rs b/src/test/run-pass/ret-break-cont-in-block.rs index 4e7e978cf55..12679284755 100644 --- a/src/test/run-pass/ret-break-cont-in-block.rs +++ b/src/test/run-pass/ret-break-cont-in-block.rs @@ -22,8 +22,8 @@ fn find_pos<T:Eq>(n: T, h: ~[T]) -> Option<uint> { fn bail_deep(x: ~[~[bool]]) { let mut seen = false; - for iter(x) |x| { - for iter(x) |x| { + for iter(copy x) |x| { + for iter(copy x) |x| { assert !seen; if x { seen = true; return; } } diff --git a/src/test/run-pass/sendfn-generic-fn.rs b/src/test/run-pass/sendfn-generic-fn.rs index be00567af67..e9b6f2bca4c 100644 --- a/src/test/run-pass/sendfn-generic-fn.rs +++ b/src/test/run-pass/sendfn-generic-fn.rs @@ -16,12 +16,12 @@ fn make_generic_record<A: Copy, B: Copy>(a: A, b: B) -> pair<A,B> { fn test05_start(&&f: fn~(&&v: float, &&v: ~str) -> pair<float, ~str>) { let p = f(22.22f, ~"Hi"); - log(debug, p); + log(debug, copy p); assert p.a == 22.22f; assert p.b == ~"Hi"; let q = f(44.44f, ~"Ho"); - log(debug, q); + log(debug, copy q); assert q.a == 44.44f; assert q.b == ~"Ho"; } diff --git a/src/test/run-pass/shape_intrinsic_tag_then_rec.rs b/src/test/run-pass/shape_intrinsic_tag_then_rec.rs index 1eb80950f9f..8fcc4e8aeaf 100644 --- a/src/test/run-pass/shape_intrinsic_tag_then_rec.rs +++ b/src/test/run-pass/shape_intrinsic_tag_then_rec.rs @@ -25,6 +25,6 @@ fn main() { let p_: path_ = { global: true, idents: ~[~"hi"], types: ~[t] }; let p: path = { data: p_, span: sp }; let x = { sp: sp, path: p }; - log(error, x.path); - log(error, x); + log(error, copy x.path); + log(error, copy x); } diff --git a/src/test/run-pass/stat.rs b/src/test/run-pass/stat.rs index 2036e1bae78..9767370fe7f 100644 --- a/src/test/run-pass/stat.rs +++ b/src/test/run-pass/stat.rs @@ -8,7 +8,7 @@ fn main() { { match io::file_writer(&path, [io::Create, io::Truncate]) { - Err(e) => fail e, + Err(copy e) => fail e, Ok(f) => { for uint::range(0, 1000) |_i| { f.write_u8(0); diff --git a/src/test/run-pass/str-append.rs b/src/test/run-pass/str-append.rs index 16e670b08b7..496fb8dcb3f 100644 --- a/src/test/run-pass/str-append.rs +++ b/src/test/run-pass/str-append.rs @@ -6,7 +6,7 @@ extern mod std; fn test1() { let mut s: ~str = ~"hello"; s += ~"world"; - log(debug, s); + log(debug, copy s); assert (s[9] == 'd' as u8); } @@ -16,8 +16,8 @@ fn test2() { let ff: ~str = ~"abc"; let a: ~str = ff + ~"ABC" + ff; let b: ~str = ~"ABC" + ff + ~"ABC"; - log(debug, a); - log(debug, b); + log(debug, copy a); + log(debug, copy b); assert (a == ~"abcABCabc"); assert (b == ~"ABCabcABC"); } diff --git a/src/test/run-pass/str-concat.rs b/src/test/run-pass/str-concat.rs index daba08e7378..a493a1f1a56 100644 --- a/src/test/run-pass/str-concat.rs +++ b/src/test/run-pass/str-concat.rs @@ -6,6 +6,6 @@ fn main() { let a: ~str = ~"hello"; let b: ~str = ~"world"; let s: ~str = a + b; - log(debug, s); + log(debug, copy s); assert (s[9] == 'd' as u8); } diff --git a/src/test/run-pass/syntax-extension-fmt.rs b/src/test/run-pass/syntax-extension-fmt.rs index fe197cb6df0..34656859cf9 100644 --- a/src/test/run-pass/syntax-extension-fmt.rs +++ b/src/test/run-pass/syntax-extension-fmt.rs @@ -1,8 +1,8 @@ extern mod std; fn test(actual: ~str, expected: ~str) { - log(debug, actual); - log(debug, expected); + log(debug, copy actual); + log(debug, copy expected); assert (actual == expected); } @@ -249,4 +249,4 @@ fn more_floats() { assert ~"99" == fmt!("%.0f", 98.5); assert ~"7.0000" == fmt!("%.4f", 6.999999999); assert ~"3.141590000" == fmt!("%.9f", 3.14159); -} \ No newline at end of file +} diff --git a/src/test/run-pass/trait-inheritance-overloading.rs b/src/test/run-pass/trait-inheritance-overloading.rs index def37d1f950..5f5ca11ffb8 100644 --- a/src/test/run-pass/trait-inheritance-overloading.rs +++ b/src/test/run-pass/trait-inheritance-overloading.rs @@ -5,7 +5,7 @@ trait MyNum : Add<self,self>, Sub<self,self>, Mul<self,self>, Eq { } struct MyInt { val: int } impl MyInt : Add<MyInt, MyInt> { - pure fn add(other: &MyInt) -> MyInt { mi(self.val + other.val) } + pure fn add(&self, other: &MyInt) -> MyInt { mi(self.val + other.val) } } impl MyInt : Sub<MyInt, MyInt> { diff --git a/src/test/run-pass/unique-assign-copy.rs b/src/test/run-pass/unique-assign-copy.rs index 2c152c9805c..0707b7a5a38 100644 --- a/src/test/run-pass/unique-assign-copy.rs +++ b/src/test/run-pass/unique-assign-copy.rs @@ -2,9 +2,9 @@ fn main() { let i = ~mut 1; // Should be a copy let mut j; - j = i; + j = copy i; *i = 2; *j = 3; assert *i == 2; assert *j == 3; -} \ No newline at end of file +} diff --git a/src/test/run-pass/unique-copy-box.rs b/src/test/run-pass/unique-copy-box.rs index e0ea3e6c0a3..caf420bdefe 100644 --- a/src/test/run-pass/unique-copy-box.rs +++ b/src/test/run-pass/unique-copy-box.rs @@ -5,8 +5,8 @@ fn main() unsafe { let i = ~@1; let j = ~@2; let rc1 = refcount(*i); - let j = i; + let j = copy i; let rc2 = refcount(*i); error!("rc1: %u rc2: %u", rc1, rc2); assert rc1 + 1u == rc2; -} \ No newline at end of file +} diff --git a/src/test/run-pass/unique-in-vec-copy.rs b/src/test/run-pass/unique-in-vec-copy.rs index f16e4b5e412..017d5ddc666 100644 --- a/src/test/run-pass/unique-in-vec-copy.rs +++ b/src/test/run-pass/unique-in-vec-copy.rs @@ -1,6 +1,6 @@ fn main() { let a = ~[~mut 10]; - let b = a; + let b = copy a; assert *a[0] == 10; assert *b[0] == 10; @@ -10,4 +10,4 @@ fn main() { assert *a[0] == 20; assert *b[0] == 10; -} \ No newline at end of file +} diff --git a/src/test/run-pass/vec-ivec-deadlock.rs b/src/test/run-pass/vec-ivec-deadlock.rs index d8bef194e47..b07481f20e9 100644 --- a/src/test/run-pass/vec-ivec-deadlock.rs +++ b/src/test/run-pass/vec-ivec-deadlock.rs @@ -1,5 +1,5 @@ fn main() { let a = ~[1, 2, 3, 4, 5]; - let mut b = ~[a, a]; + let mut b = ~[copy a, copy a]; b = b + b; // FIXME(#3387)---can't write b += b } |
