Skip to content

Commit 1f7d1ea

Browse files
Use merged_ty method instead of rewriting it every time
1 parent 14a459b commit 1f7d1ea

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler/rustc_typeck/src/check/coercion.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1488,14 +1488,14 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> {
14881488
// `break`, we want to call the `()` "expected"
14891489
// since it is implied by the syntax.
14901490
// (Note: not all force-units work this way.)"
1491-
(expression_ty, self.final_ty.unwrap_or(self.expected_ty))
1491+
(expression_ty, self.merged_ty())
14921492
} else {
14931493
// Otherwise, the "expected" type for error
14941494
// reporting is the current unification type,
14951495
// which is basically the LUB of the expressions
14961496
// we've seen so far (combined with the expected
14971497
// type)
1498-
(self.final_ty.unwrap_or(self.expected_ty), expression_ty)
1498+
(self.merged_ty(), expression_ty)
14991499
};
15001500
let (expected, found) = fcx.resolve_vars_if_possible((expected, found));
15011501

0 commit comments

Comments
 (0)