You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Provide context when type error happens due to different fn arguments with the same type parameter are called with different types #116615
error[E0308]: mismatched types
--> src/main.rs:2:12
|
2 | foo(1, 2.);| --- ^^ expected integer, found floating-point number
||| arguments to this functionare incorrect
|
note: functiondefined 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 functionare incorrect
|
note: functiondefined 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`
Spent the last week on this now and put a draft PR here for feedback at this stage, though not essential if I don't get it at this stage: #121595
It's mostly working now, though there are likely to be improvements yet and I'd like to do a review of it myself before pushing even which I'll probably do later next week.
Activity
strottos commentedon Feb 21, 2024
@rustbot claim
I think I can see how to implement this, will give it a go and unassign if it doesn't work.
strottos commentedon Feb 25, 2024
Spent the last week on this now and put a draft PR here for feedback at this stage, though not essential if I don't get it at this stage: #121595
It's mostly working now, though there are likely to be improvements yet and I'd like to do a review of it myself before pushing even which I'll probably do later next week.
Rollup merge of rust-lang#121595 - strottos:issue_116615, r=compiler-…
Unrolled build for rust-lang#121595
strottos commentedon Apr 4, 2024
This has been merged now, I believe the issue can be closed.