]>
Commit | Line | Data |
---|---|---|
223e47cc LB |
1 | // Test that a class with a non-copyable field can't be |
2 | // copied | |
1a4d82fc | 3 | |
85aaf69f | 4 | #[derive(Debug)] |
0731742a | 5 | struct Bar { |
1a4d82fc | 6 | x: isize, |
223e47cc LB |
7 | } |
8 | ||
0731742a | 9 | impl Drop for Bar { |
1a4d82fc | 10 | fn drop(&mut self) {} |
223e47cc LB |
11 | } |
12 | ||
0731742a XL |
13 | fn bar(x:isize) -> Bar { |
14 | Bar { | |
223e47cc LB |
15 | x: x |
16 | } | |
17 | } | |
18 | ||
85aaf69f | 19 | #[derive(Debug)] |
0731742a | 20 | struct Foo { |
1a4d82fc | 21 | i: isize, |
0731742a | 22 | j: Bar, |
223e47cc LB |
23 | } |
24 | ||
0731742a XL |
25 | fn foo(i:isize) -> Foo { |
26 | Foo { | |
223e47cc LB |
27 | i: i, |
28 | j: bar(5) | |
29 | } | |
30 | } | |
31 | ||
32 | fn main() { | |
33 | let x = foo(10); | |
d9579d0f | 34 | let _y = x.clone(); //~ ERROR no method named `clone` found |
1a4d82fc | 35 | println!("{:?}", x); |
223e47cc | 36 | } |