-
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
Improve type mismatch w/ function signatures #99862
Conversation
This also fixes the argument names in `report_closure_arg_mismatch` (confusing expected/found)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As usual I'm not sure about the wording, but other than that I think this is an improvement :")
//~| NOTE: in this expansion of desugaring of `impl Trait` | ||
//~| NOTE: in this expansion of desugaring of `impl Trait` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what's up with these notes, they don't even render in console...
be9642b
to
7da578b
Compare
@WaffleLapkin actually I do prefer mentioning "expected closure signature", since otherwise people may think we're comparing fn ptrs. Sorry for the back and forth 😿 r=me after reverting back to 7da578b @bors delegate+ |
✌️ @WaffleLapkin can now approve this pull request |
2e63d78
to
7da578b
Compare
@bors r=compiler-errors |
Rollup of 5 pull requests Successful merges: - rust-lang#99311 (change maybe_body_owned_by to take local def id) - rust-lang#99862 (Improve type mismatch w/ function signatures) - rust-lang#99895 (don't call type ascription "cast") - rust-lang#99900 (remove some manual hash stable impls) - rust-lang#99903 (Add diagnostic when using public instead of pub) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 5 pull requests Successful merges: - rust-lang#99311 (change maybe_body_owned_by to take local def id) - rust-lang#99862 (Improve type mismatch w/ function signatures) - rust-lang#99895 (don't call type ascription "cast") - rust-lang#99900 (remove some manual hash stable impls) - rust-lang#99903 (Add diagnostic when using public instead of pub) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This PR makes use of
note: expected/found
(instead of labeling types in labels) in type mismatch with function signatures. Pros: it's easier to compare the signatures, cons: the error is a little more verbose now.This is especially nice when
isize
vsusize
(there is a better chance that the types align)Also this PR fixes the inconsistency in variable names in the edited code (
expected
andfound
).A zulip thread from which this pr started: [link].
An example diagnostic:
code
r? @compiler-errors