os-rust/src/test/compile-fail/noncopyable-class.rs

18 lines
328 B
Rust
Raw Normal View History

// 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-06-06 14:58:41 -07:00
let x: int;
new(x:int) {self.x = x;}
drop {}
}
2012-08-15 18:46:55 -07:00
struct foo {
let i: int;
let j: bar;
2012-06-06 14:58:41 -07:00
new(i:int) { self.i = i; self.j = bar(5); }
}
fn main() { let x <- foo(10); let y = x; log(error, x); }