-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Suggest function call on pattern type mismatch #107098
Conversation
r? @TaKO8Ki (rustbot has picked a reviewer for you, use r? to override) |
let mut diag = self.err_ctxt().report_mismatched_types(cause, expected, actual, e); | ||
mutate_err(&mut diag); | ||
Some(diag) | ||
} |
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.
Why add a closure, and not have the caller modify the returned value?
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.
I had originally thought to pass in the TypeError that resulted from the demand call, but then I didn't need it anymore, so this is just an artifact of that old design.
eac8b4f
to
f900104
Compare
It has been two weeks, I'm assuming that @TaKO8Ki is not reviewing at the moment. r? compiler |
@bors r+ rollup |
…ll, r=lcnr Suggest function call on pattern type mismatch Fixes rust-lang#101208 This could definitely be generalized to support more suggestions in pattern matches. We can't use all of [`FnCtxt::emit_type_mismatch_suggestions`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_typeck/fn_ctxt/struct.FnCtxt.html#method.emit_type_mismatch_suggestions), but it's on my to-do list to play around with more suggestions that would be productive in this position.
Failed in a rollup (and locally)
|
…ll, r=lcnr Suggest function call on pattern type mismatch Fixes rust-lang#101208 This could definitely be generalized to support more suggestions in pattern matches. We can't use all of [`FnCtxt::emit_type_mismatch_suggestions`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_typeck/fn_ctxt/struct.FnCtxt.html#method.emit_type_mismatch_suggestions), but it's on my to-do list to play around with more suggestions that would be productive in this position.
Whoops, matthias commented but didn't r- @bors r- |
f900104
to
0eba2f3
Compare
@bors r=lcnr |
…ll, r=lcnr Suggest function call on pattern type mismatch Fixes rust-lang#101208 This could definitely be generalized to support more suggestions in pattern matches. We can't use all of [`FnCtxt::emit_type_mismatch_suggestions`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_typeck/fn_ctxt/struct.FnCtxt.html#method.emit_type_mismatch_suggestions), but it's on my to-do list to play around with more suggestions that would be productive in this position.
Rollup of 9 pull requests Successful merges: - rust-lang#105019 (Add parentheses properly for borrowing suggestion) - rust-lang#106001 (Stop at the first `NULL` argument when iterating `argv`) - rust-lang#107098 (Suggest function call on pattern type mismatch) - rust-lang#107490 (rustdoc: remove inconsistently-present sidebar tooltips) - rust-lang#107855 (Add a couple random projection tests for new solver) - rust-lang#107857 (Add ui test for implementation on projection) - rust-lang#107878 (Clarify `new_size` for realloc means bytes) - rust-lang#107888 (revert rust-lang#107074, add regression test) - rust-lang#107900 (Zero the `REPARSE_MOUNTPOINT_DATA_BUFFER` header) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fixes #101208
This could definitely be generalized to support more suggestions in pattern matches. We can't use all of
FnCtxt::emit_type_mismatch_suggestions
, but it's on my to-do list to play around with more suggestions that would be productive in this position.