Remove single use helper function.
This commit is contained in:
parent
21641d6d2c
commit
ba5a5cf219
2 changed files with 4 additions and 16 deletions
|
|
@ -2833,19 +2833,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||
fn check_expr_coercable_to_type(&self,
|
||||
expr: &'gcx hir::Expr,
|
||||
expected: Ty<'tcx>) -> Ty<'tcx> {
|
||||
self.check_expr_coercable_to_type_with_needs(expr, expected, Needs::None)
|
||||
}
|
||||
|
||||
fn check_expr_coercable_to_type_with_needs(&self,
|
||||
expr: &'gcx hir::Expr,
|
||||
expected: Ty<'tcx>,
|
||||
needs: Needs)
|
||||
-> Ty<'tcx> {
|
||||
let ty = self.check_expr_with_expectation_and_needs(
|
||||
expr,
|
||||
ExpectHasType(expected),
|
||||
needs);
|
||||
// checks don't need two phase
|
||||
let ty = self.check_expr_with_hint(expr, expected);
|
||||
self.demand_coerce(expr, ty, expected, AllowTwoPhase::No)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -174,9 +174,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||
// trait matching creating lifetime constraints that are too strict.
|
||||
// E.g. adding `&'a T` and `&'b T`, given `&'x T: Add<&'x T>`, will result
|
||||
// in `&'a T <: &'x T` and `&'b T <: &'x T`, instead of `'a = 'b = 'x`.
|
||||
let lhs_ty = self.check_expr_coercable_to_type_with_needs(lhs_expr,
|
||||
self.next_ty_var(TypeVariableOrigin::MiscVariable(lhs_expr.span)),
|
||||
lhs_needs);
|
||||
let lhs_ty = self.check_expr_with_needs(lhs_expr, lhs_needs);
|
||||
let fresh_var = self.next_ty_var(TypeVariableOrigin::MiscVariable(lhs_expr.span));
|
||||
let lhs_ty = self.demand_coerce(lhs_expr, lhs_ty, fresh_var, AllowTwoPhase::No);
|
||||
let lhs_ty = self.resolve_type_vars_with_obligations(lhs_ty);
|
||||
|
||||
// NB: As we have not yet type-checked the RHS, we don't have the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue