1
Fork 0

test: More bustage fixes. rs=me

This commit is contained in:
Patrick Walton 2012-12-05 17:36:51 -08:00
parent 6084032270
commit e1685dd990
9 changed files with 11 additions and 11 deletions

View file

@ -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 = *(copy *req.get(~"METHOD"))[0u];
let _x = copy *(copy *req.get(~"METHOD"))[0u];
}

View file

@ -1,7 +1,7 @@
fn main() {
let x = ~{mut a: ~10, b: ~20};
match x {
~{a: ref a, b: ref b} => {
~{a: ref mut a, b: ref mut b} => {
assert **a == 10; (*x).a = ~30; assert **a == 30;
}
}

View file

@ -12,7 +12,7 @@ mod kitty {
}
impl cat {
fn get_name() -> ~str { self.name }
fn get_name() -> ~str { copy self.name }
}
fn cat(in_name: ~str) -> cat {
@ -26,4 +26,4 @@ mod kitty {
fn main() {
assert(cat(~"Spreckles").get_name() == ~"Spreckles");
}
}

View file

@ -45,7 +45,7 @@ fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
}
impl cat: ToStr {
pure fn to_str() -> ~str { self.name }
pure fn to_str() -> ~str { copy self.name }
}
fn print_out<T: ToStr>(thing: T, expected: ~str) {

View file

@ -9,7 +9,7 @@ fn main() {
match getopts(args, opts) {
result::Ok(ref m) =>
assert !opt_present(m, "b"),
result::Err(ref f) => fail fail_str(*f)
result::Err(ref f) => fail fail_str(copy *f)
};
}

View file

@ -4,5 +4,5 @@ fn main() {
fn invoke(f: fn@()) { f(); }
let k = ~22;
let _u = {a: copy k};
invoke(|| log(error, k) )
invoke(|| log(error, copy k) )
}

View file

@ -25,7 +25,7 @@ impl Point : ops::Neg<Point> {
}
impl Point : ops::Index<bool,int> {
pure fn index(+x: bool) -> int {
pure fn index(&self, +x: bool) -> int {
if x { self.x } else { self.y }
}
}

View file

@ -13,7 +13,7 @@ fn iter<T>(v: ~[T], it: fn(T) -> bool) {
fn find_pos<T:Eq>(n: T, h: ~[T]) -> Option<uint> {
let mut i = 0u;
for iter(h) |e| {
for iter(copy h) |e| {
if e == n { return Some(i); }
i += 1u;
}

View file

@ -1,9 +1,9 @@
fn main() {
let i = ~mut 1;
// Should be a copy
let j = i;
let j = copy i;
*i = 2;
*j = 3;
assert *i == 2;
assert *j == 3;
}
}