1 // this will get a no-op Clone impl
8 // this will get a deep Clone impl
15 struct C; // not Copy or Clone
16 #[derive(Clone)] struct D; // Clone but not Copy
18 fn is_copy<T: Copy>(_: T) {}
19 fn is_clone<T: Clone>(_: T) {}
22 // A can be copied and cloned
23 is_copy(A { a: 1, b: 2 });
24 is_clone(A { a: 1, b: 2 });
26 // B<i32> can be copied and cloned
27 is_copy(B { a: 1, b: 2 });
28 is_clone(B { a: 1, b: 2 });
30 // B<C> cannot be copied or cloned
31 is_copy(B { a: 1, b: C }); //~ ERROR Copy
32 is_clone(B { a: 1, b: C }); //~ ERROR Clone
34 // B<D> can be cloned but not copied
35 is_copy(B { a: 1, b: D }); //~ ERROR Copy
36 is_clone(B { a: 1, b: D });