-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mismatched type errors have become useless #39343
Comments
This actually looks like a change in coercion? That is, a mismatch in the signature used to prevent the coercion, resulting in the subtyping fallback which simply fails, at the othermost level, whereas now the coercion is attempted and the error from inside the signature mismatch is being reported. |
@eddyb any clues what change might have caused that? cc @estebank @jonathandturner -- this doesn't look familiar, does it? |
@nikomatsakis - not to me. I thought we still always showed the expected/found full type since sometimes you need it to understand the error (this one included) |
@nikomatsakis sadly, it doesn't for me either. @jonathandturner it doesn't if the type mismatch is between primitive types, which leads me to think that somewhere a |
triage: P-high - serious diagnostic regression, assign to @pnkfelix. |
While doing something else around type errors, I realized by chance why this was happening. |
(seems like #39905 will fix this.) |
Properly display note/expected details Given a file ```rust fn takes_cb(f: fn(i8)) {} fn main() { fn callback(x: i32) {} takes_cb(callback) } ``` output ```rust error[E0308]: mismatched types --> file2.rs:5:22 | 5 | takes_cb(callback) | ^^^^^^^^ expected i8, found i32 | = note: expected type `fn(i8)` found type `fn(i32) {main::callback}` ``` Fix rust-lang#39343.
Properly display note/expected details Given a file ```rust fn takes_cb(f: fn(i8)) {} fn main() { fn callback(x: i32) {} takes_cb(callback) } ``` output ```rust error[E0308]: mismatched types --> file2.rs:5:22 | 5 | takes_cb(callback) | ^^^^^^^^ expected i8, found i32 | = note: expected type `fn(i8)` found type `fn(i32) {main::callback}` ``` Fix rust-lang#39343.
Properly display note/expected details Given a file ```rust fn takes_cb(f: fn(i8)) {} fn main() { fn callback(x: i32) {} takes_cb(callback) } ``` output ```rust error[E0308]: mismatched types --> file2.rs:5:22 | 5 | takes_cb(callback) | ^^^^^^^^ expected i8, found i32 | = note: expected type `fn(i8)` found type `fn(i32) {main::callback}` ``` Fix rust-lang#39343.
A minimal test case. My actual case is much more complex, involves functions/callbacks with multiple params and several layers of typedefs.
The error reported on 1.11.0 is this:
Useful and obvious. What error looks like now (stable (1.14.0)/beta/nightly (1.16.0))?
Cute but is as worthless and confusing as it gets.
The text was updated successfully, but these errors were encountered: