2012-08-03 12:22:16 -05:00
|
|
|
// A test case for #2548.
|
|
|
|
|
|
|
|
struct foo {
|
|
|
|
x: @mut int;
|
|
|
|
|
|
|
|
|
|
|
|
drop {
|
|
|
|
io::println("Goodbye, World!");
|
|
|
|
*self.x += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-06 17:42:59 -05:00
|
|
|
fn foo(x: @mut int) -> foo {
|
|
|
|
foo { x: x }
|
|
|
|
}
|
|
|
|
|
2012-08-03 12:22:16 -05:00
|
|
|
fn main() {
|
|
|
|
let x = @mut 0;
|
|
|
|
|
|
|
|
{
|
|
|
|
let mut res = foo(x);
|
|
|
|
|
|
|
|
let mut v = ~[mut];
|
2012-09-06 17:42:59 -05:00
|
|
|
v <- ~[mut res] + v; //~ ERROR instantiating a type parameter with an incompatible type (needs `copy`, got `owned`, missing `copy`)
|
|
|
|
assert (v.len() == 2);
|
2012-08-03 12:22:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
assert *x == 1;
|
|
|
|
}
|