Skip to content

Commit be25e78

Browse files
committed
Remove single use helper function.
1 parent fb5b5f5 commit be25e78

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

src/librustc_typeck/check/mod.rs

+1-12
Original file line numberDiff line numberDiff line change
@@ -2829,18 +2829,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
28292829
fn check_expr_coercable_to_type(&self,
28302830
expr: &'gcx hir::Expr,
28312831
expected: Ty<'tcx>) -> Ty<'tcx> {
2832-
self.check_expr_coercable_to_type_with_needs(expr, expected, Needs::None)
2833-
}
2834-
2835-
fn check_expr_coercable_to_type_with_needs(&self,
2836-
expr: &'gcx hir::Expr,
2837-
expected: Ty<'tcx>,
2838-
needs: Needs)
2839-
-> Ty<'tcx> {
2840-
let ty = self.check_expr_with_expectation_and_needs(
2841-
expr,
2842-
ExpectHasType(expected),
2843-
needs);
2832+
let ty = self.check_expr_with_hint(expr, expected);
28442833
self.demand_coerce(expr, ty, expected)
28452834
}
28462835

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);
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)