@derive(Eq) struct Container { val: int; } // Ensure derived eq uses pointers by trying to use 'c2' after comparison test "eq_moves" { let c1 = Container { val: 10 }; let c2 = Container { val: 10 }; // This should call Container__eq(&c1, &c2) // If it passed by value, c2 would be moved here if c1 == c2 { // c2 must still be valid assert(c2.val == 10, "c2 moved during equality check!"); } else { assert(false, "c1 != c2"); } // Explicitly verify c2 is still valid c2.val = 20; assert(c2.val == 20, "c2 invalid"); println "Smart Derive Eq Works!"; }