2012-08-03 12:22:16 -05:00
|
|
|
// A test case for #2548.
|
|
|
|
|
|
|
|
struct foo {
|
2012-09-07 16:50:47 -05:00
|
|
|
x: @mut int,
|
2012-08-03 12:22:16 -05:00
|
|
|
|
|
|
|
|
2012-11-14 00:22:37 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
impl foo : Drop {
|
|
|
|
fn finalize() {
|
2012-08-03 12:22:16 -05:00
|
|
|
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-10-23 13:11:23 -05:00
|
|
|
v = move ~[mut (move res)] + v; //~ ERROR instantiating a type parameter with an incompatible type (needs `copy`, got `owned`, missing `copy`)
|
2012-09-06 17:42:59 -05:00
|
|
|
assert (v.len() == 2);
|
2012-08-03 12:22:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
assert *x == 1;
|
|
|
|
}
|