trait Copy {} struct Point { x: int; y: int; } impl Copy for Point {} struct Mover { val: int; } test "copy_trait" { let p1 = Point { x: 10, y: 20 }; let p2 = p1; // Copy, not move // Both should be valid assert(p1.x == 10, "p1 invalid after copy"); assert(p2.x == 10, "p2 invalid after copy"); // Modify p2, p1 should be unchanged p2.x = 30; assert(p1.x == 10, "p1 changed after p2 modification"); assert(p2.x == 30, "p2 modification failed"); println "Copy Trait Works!"; } test "move_default" { let m1 = Mover { val: 1 }; let m2 = m1; // Moved // Uncommenting this should cause compile error // let m3 = m1; }