[beta] Do not call check_expr twice in check_compatible#99397
Closed
compiler-errors wants to merge 1 commit intorust-lang:betafrom
Hidden character warning
The head ref may contain hidden characters: "\ud83c\udd71-arg-mismatch-adjustment-bug"
Closed
[beta] Do not call check_expr twice in check_compatible#99397compiler-errors wants to merge 1 commit intorust-lang:betafrom
check_expr twice in check_compatible#99397compiler-errors wants to merge 1 commit intorust-lang:betafrom
Conversation
Contributor
|
r? @jackh726 (rust-highfive has picked a reviewer for you, use r? to override) |
Contributor
|
compiler-errors
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)); |
Contributor
Author
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.
Member
|
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! |
Contributor
Author
|
@jackh726 is familiar with this code, though feel free to reassign as always. |
Contributor
|
@rustbot label: +beta-accepted |
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jul 22, 2022
[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
Contributor
|
I took the comments from jackh and pnkfelix as approval. Closing as merged via #99586. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.