ab21557501
Highlight parts of fn in type errors When a type error arises between two fn items, fn pointers or tuples, highlight only the differing parts of each. Examples: <img width="699" alt="" src="https://user-images.githubusercontent.com/1606434/69487597-ab561600-0e11-11ea-9b4e-d4fd9e91d5dc.png"> <img width="528" alt="" src="https://user-images.githubusercontent.com/1606434/69487207-9033d800-0e0a-11ea-93e3-8c4d002411a5.png"> <img width="468" alt="" src="https://user-images.githubusercontent.com/1606434/69487208-9033d800-0e0a-11ea-92e3-2b2cee120335.png"> <img width="775" alt="" src="https://user-images.githubusercontent.com/1606434/69487209-9033d800-0e0a-11ea-9e68-7f6ed5c8cb08.png">
46 lines
1.7 KiB
Plaintext
46 lines
1.7 KiB
Plaintext
error[E0053]: method `mul` has an incompatible type for trait
|
|
--> $DIR/wrong-mul-method-signature.rs:16:5
|
|
|
|
|
LL | fn mul(self, s: &f64) -> Vec1 {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `f64`, found `&f64`
|
|
|
|
|
= note: expected fn pointer `fn(Vec1, f64) -> Vec1`
|
|
found fn pointer `fn(Vec1, &f64) -> Vec1`
|
|
|
|
error[E0053]: method `mul` has an incompatible type for trait
|
|
--> $DIR/wrong-mul-method-signature.rs:33:5
|
|
|
|
|
LL | fn mul(self, s: f64) -> Vec2 {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Vec2`, found `f64`
|
|
|
|
|
= note: expected fn pointer `fn(Vec2, Vec2) -> f64`
|
|
found fn pointer `fn(Vec2, f64) -> Vec2`
|
|
|
|
error[E0053]: method `mul` has an incompatible type for trait
|
|
--> $DIR/wrong-mul-method-signature.rs:52:5
|
|
|
|
|
LL | fn mul(self, s: f64) -> f64 {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `f64`
|
|
|
|
|
= note: expected fn pointer `fn(Vec3, _) -> i32`
|
|
found fn pointer `fn(Vec3, _) -> f64`
|
|
|
|
error[E0308]: mismatched types
|
|
--> $DIR/wrong-mul-method-signature.rs:63:45
|
|
|
|
|
LL | let x: Vec2 = Vec2 { x: 1.0, y: 2.0 } * 2.0; // trait had reversed order
|
|
| ^^^ expected struct `Vec2`, found floating-point number
|
|
|
|
error[E0308]: mismatched types
|
|
--> $DIR/wrong-mul-method-signature.rs:63:19
|
|
|
|
|
LL | let x: Vec2 = Vec2 { x: 1.0, y: 2.0 } * 2.0; // trait had reversed order
|
|
| ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Vec2`, found `f64`
|
|
| |
|
|
| expected due to this
|
|
|
|
error: aborting due to 5 previous errors
|
|
|
|
Some errors have detailed explanations: E0053, E0308.
|
|
For more information about an error, try `rustc --explain E0053`.
|