summary refs log tree commit diff
path: root/src/test/compile-fail/noncopyable-class.rs
blob: 736fee0f66cb9e2ef575fe09974b9e0706f787de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// error-pattern: copying a noncopyable value

// Test that a class with a non-copyable field can't be
// copied
class bar {
  let x: int;
  new(x:int) {self.x = x;}
  drop {}
}

class foo {
  let i: int;
  let j: bar;
  new(i:int) { self.i = i; self.j = bar(5); }
}

fn main() { let x <- foo(10); let y = x; log(error, x); }