Skip to content

Commit ba5a5cf

Browse files
committed
Remove single use helper function.
1 parent 21641d6 commit ba5a5cf

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

src/librustc_typeck/check/mod.rs

+1-13
Original file line numberDiff line numberDiff line change
@@ -2833,19 +2833,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
28332833
fn check_expr_coercable_to_type(&self,
28342834
expr: &'gcx hir::Expr,
28352835
expected: Ty<'tcx>) -> Ty<'tcx> {
2836-
self.check_expr_coercable_to_type_with_needs(expr, expected, Needs::None)
2837-
}
2838-
2839-
fn check_expr_coercable_to_type_with_needs(&self,
2840-
expr: &'gcx hir::Expr,
2841-
expected: Ty<'tcx>,
2842-
needs: Needs)
2843-
-> Ty<'tcx> {
2844-
let ty = self.check_expr_with_expectation_and_needs(
2845-
expr,
2846-
ExpectHasType(expected),
2847-
needs);
2848-
// checks don't need two phase
2836+
let ty = self.check_expr_with_hint(expr, expected);
28492837
self.demand_coerce(expr, ty, expected, AllowTwoPhase::No)
28502838
}
28512839

src/librustc_typeck/check/op.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
174174
// trait matching creating lifetime constraints that are too strict.
175175
// E.g. adding `&'a T` and `&'b T`, given `&'x T: Add<&'x T>`, will result
176176
// in `&'a T <: &'x T` and `&'b T <: &'x T`, instead of `'a = 'b = 'x`.
177-
let lhs_ty = self.check_expr_coercable_to_type_with_needs(lhs_expr,
178-
self.next_ty_var(TypeVariableOrigin::MiscVariable(lhs_expr.span)),
179-
lhs_needs);
177+
let lhs_ty = self.check_expr_with_needs(lhs_expr, lhs_needs);
178+
let fresh_var = self.next_ty_var(TypeVariableOrigin::MiscVariable(lhs_expr.span));
179+
let lhs_ty = self.demand_coerce(lhs_expr, lhs_ty, fresh_var, AllowTwoPhase::No);
180180
let lhs_ty = self.resolve_type_vars_with_obligations(lhs_ty);
181181

182182
// NB: As we have not yet type-checked the RHS, we don't have the

0 commit comments

Comments
 (0)