gcc/testsuite/rust/execute/torture/derive_macro1.rs
raw| 1 | #[lang = "sized"] |
| 2 | pub trait Sized {} |
| 3 | |
| 4 | pub trait Clone { |
| 5 | fn clone(&self) -> Self; |
| 6 | } |
| 7 | |
| 8 | pub trait Copy {} |
| 9 | |
| 10 | impl Copy for i32 {} |
| 11 | |
| 12 | impl<T> Clone for T |
| 13 | where |
| 14 | T: Copy, |
| 15 | { |
| 16 | fn clone(&self) -> Self { |
| 17 | *self |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | fn main() -> i32 { |
| 22 | let a = 15i32; |
| 23 | let b = a.clone(); |
| 24 | |
| 25 | a - b |
| 26 | } |