diff options
| author | Guillaume Gomez <guillaume.gomez@huawei.com> | 2022-08-16 15:33:46 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume.gomez@huawei.com> | 2022-08-16 15:33:46 +0200 |
| commit | 1f7d1eae9677f16a94a15b58d2b2477ad0776bd7 (patch) | |
| tree | 9b2206b73119e8b682921ce84612a4e443be1a70 | |
| parent | 14a459bf37bc19476d43e0045d078121c12d3fef (diff) | |
| download | rust-1f7d1eae9677f16a94a15b58d2b2477ad0776bd7.tar.gz rust-1f7d1eae9677f16a94a15b58d2b2477ad0776bd7.zip | |
Use `merged_ty` method instead of rewriting it every time
| -rw-r--r-- | compiler/rustc_typeck/src/check/coercion.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_typeck/src/check/coercion.rs b/compiler/rustc_typeck/src/check/coercion.rs index da575cb1367..def592c46c2 100644 --- a/compiler/rustc_typeck/src/check/coercion.rs +++ b/compiler/rustc_typeck/src/check/coercion.rs @@ -1488,14 +1488,14 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> { // `break`, we want to call the `()` "expected" // since it is implied by the syntax. // (Note: not all force-units work this way.)" - (expression_ty, self.final_ty.unwrap_or(self.expected_ty)) + (expression_ty, self.merged_ty()) } else { // Otherwise, the "expected" type for error // reporting is the current unification type, // which is basically the LUB of the expressions // we've seen so far (combined with the expected // type) - (self.final_ty.unwrap_or(self.expected_ty), expression_ty) + (self.merged_ty(), expression_ty) }; let (expected, found) = fcx.resolve_vars_if_possible((expected, found)); |
