Uh oh!
There was an error while loading. Please reload this page.
[beta] Do not call check_expr twice in check_compatible - #99397
Hidden character warning
[beta] Do not call check_expr twice in check_compatible#99397compiler-errors wants to merge 1 commit into
check_expr twice in check_compatible#99397Conversation
rust-highfive
commented
Jul 18, 2022
r? @jackh726 (rust-highfive has picked a reviewer for you, use r? to override) |
rust-highfive
commented
Jul 18, 2022
|
| // so I prodded this method and made it pub(super) so I could call it, and it seems to work well. | ||
| let checked_ty = self.check_expr_kind(provided_arg, expectation); | ||
| let already_checked_ty = self.typeck_results.borrow().expr_ty_adjusted_opt(provided_arg); | ||
| let checked_ty = already_checked_ty.unwrap_or_else(|| self.check_expr(provided_arg)); |
There was a problem hiding this comment.
After #98785, we can assume that expr_ty_adjusted_opt called on an arg expression always returns Some, but since that PR is not on beta yet, we cannot -- so only call check_expr if we haven't already evaluated it once.
Mark-Simulacrum
commented
Jul 18, 2022
I think a new beta nomination won't hurt, but isn't strictly necessary. We should definitely get a fresh review from someone familiar with the code though! |
compiler-errors
commented
Jul 18, 2022
@jackh726 is familiar with this code, though feel free to reassign as always. |
@rustbot label: +beta-accepted |
[beta] Beta 1.63 backports * Reference: Revert $$ macro_metavar rust-lang/reference#1192 * Revert "Stabilize $$ in Rust 1.63.0" rust-lang#99435 * rustdoc: avoid inlining items with duplicate `(type, name)` rust-lang#99344 * Do not call `check_expr` twice in `check_compatible` rust-lang#99397
ehuss
commented
Jul 22, 2022
I took the comments from jackh and pnkfelix as approval. Closing as merged via #99586. |
This fixes#98894 and #98897 on the beta branch, since my original fix#98785 does not merge cleanly onto beta.
Should I nominate this for beta backport again, since it's basically a different fix compared to the one that was approved? Regardless, it's actually a slightly smaller change than #98785.