Skip to content

Commit

Permalink
Rollup merge of #100629 - GuillaumeGomez:merged-ty, r=compiler-errors
Browse files Browse the repository at this point in the history
Use `merged_ty` method instead of rewriting it every time

`merged_ty` [source code](https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_typeck/check/coercion.rs.html#1331-1333) is quite literally the same, so instead of rewriting it, makes more sense to use the method instead.

r? `@compiler-errors`
  • Loading branch information
TaKO8Ki authored Aug 16, 2022
2 parents b7b4f79 + 1f7d1ea commit 033387a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_typeck/src/check/coercion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down

0 comments on commit 033387a

Please sign in to comment.