1 // This test is to make sure we don't just ICE if the trait
2 // method for an operator is not implemented properly.
3 // (In this case the mul method should take &f64 and not f64)
12 // Expecting value in input signature
13 impl Mul<f64> for Vec1 {
16 fn mul(self, s: &f64) -> Vec1 {
17 //~^ ERROR method `mul` has an incompatible type for trait
29 // Wrong type parameter ordering
30 impl Mul<Vec2> for Vec2 {
33 fn mul(self, s: f64) -> Vec2 {
34 //~^ ERROR method `mul` has an incompatible type for trait
48 // Unexpected return type
49 impl Mul<f64> for Vec3 {
52 fn mul(self, s: f64) -> f64 {
53 //~^ ERROR method `mul` has an incompatible type for trait
59 // Check that the usage goes from the trait declaration:
61 let x: Vec1 = Vec1 { x: 1.0 } * 2.0; // this is OK
63 let x: Vec2 = Vec2 { x: 1.0, y: 2.0 } * 2.0; // trait had reversed order
64 //~^ ERROR mismatched types
65 //~| ERROR mismatched types
67 let x: i32 = Vec3 { x: 1.0, y: 2.0, z: 3.0 } * 2.0;