Closed
Description
Code
fn main() {
foo(1, 2.);
}
fn foo<T>(a: T, b: T) {}
Current output
error[E0308]: mismatched types
--> src/main.rs:2:12
|
2 | foo(1, 2.);
| --- ^^ expected integer, found floating-point number
| |
| arguments to this function are incorrect
|
note: function defined here
--> src/main.rs:4:4
|
4 | fn foo<T>(a: T, b: T) {}
| ^^^ ----
Desired output
error[E0308]: mismatched types
--> src/main.rs:2:12
|
2 | foo(1, 2.);
| --- - ^^ expected integer, found floating-point number
| | |
| | expected because that argument needs to match the integer type of this parameter
| |
| arguments to this function are incorrect
|
note: function defined here
--> src/main.rs:4:4
|
4 | fn foo<T>(a: T, b: T) {}
| ^^^ - ---- ----
| | | |
| | | this parameter needs to match the type of `a`
| | `b` needs to match the type of this parameter
| `a` and `b` both reference type parameter `T`
Rationale and extra context
No response
Other cases
No response
Anything else?
No response
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: Type systemDiagnostics: Confusing error or lint; hard to understand for new users.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.Relevant to the compiler team, which will review and decide on the PR/issue.