-
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
[beta] Do not call check_expr
twice in check_compatible
#99397
The head ref may contain hidden characters: "\u{1F171}-arg-mismatch-adjustment-bug"
[beta] Do not call check_expr
twice in check_compatible
#99397
Conversation
r? @jackh726 (rust-highfive has picked a reviewer for you, use r? to override) |
|
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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! |
@jackh726 is familiar with this code, though feel free to reassign as always. |
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.
LGTM
@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
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.