// TDD TEST: Method with self by value should not infer &mut
struct Mat4 {
m00: f32
}
impl Mat4 {
fn new(value: f32) -> Mat4 {
Mat4 { m00: value }
}
// This method takes self BY VALUE (not & or &mut)
// Compiler should NOT infer &mut
fn multiply(self, other: Mat4) -> Mat4 {
Mat4 {
m00: self.m00 * other.m00
}
}
}
fn main() {
// This should NOT require mut
let identity = Mat4::new(1.0)
let other = Mat4::new(2.0)
// This call should work without mut
let result = identity.multiply(other)
assert(result.m00 == 2.0, "Should multiply")
println("✅ Method with self by value works correctly")
}