2012-06-01 17:48:07 -07:00
|
|
|
// error-pattern: copying a noncopyable value
|
|
|
|
|
|
|
|
// Test that a class with a non-copyable field can't be
|
|
|
|
// copied
|
2012-08-15 18:46:55 -07:00
|
|
|
struct bar {
|
2012-09-06 19:40:15 -07:00
|
|
|
x: int,
|
2012-06-01 17:48:07 -07:00
|
|
|
drop {}
|
|
|
|
}
|
|
|
|
|
2012-09-05 15:58:43 -07:00
|
|
|
fn bar(x:int) -> bar {
|
|
|
|
bar {
|
|
|
|
x: x
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-15 18:46:55 -07:00
|
|
|
struct foo {
|
2012-09-06 19:40:15 -07:00
|
|
|
i: int,
|
|
|
|
j: bar,
|
2012-09-05 15:58:43 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
fn foo(i:int) -> foo {
|
|
|
|
foo {
|
|
|
|
i: i,
|
|
|
|
j: bar(5)
|
|
|
|
}
|
2012-06-01 17:48:07 -07:00
|
|
|
}
|
|
|
|
|
2012-10-23 11:11:23 -07:00
|
|
|
fn main() { let x = move foo(10); let y = x; log(error, x); }
|