Skip to content

Commit a63bb24

Browse files
Inline one usage of check_expr_eq_type
1 parent f3589a7 commit a63bb24

File tree

1 file changed

+4
-8
lines changed
  • compiler/rustc_hir_typeck/src

1 file changed

+4
-8
lines changed

compiler/rustc_hir_typeck/src/expr.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,6 @@ use rustc_trait_selection::traits::ObligationCtxt;
6060
use rustc_trait_selection::traits::{self, ObligationCauseCode};
6161

6262
impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
63-
fn check_expr_eq_type(&self, expr: &'tcx hir::Expr<'tcx>, expected: Ty<'tcx>) {
64-
let ty = self.check_expr_with_hint(expr, expected);
65-
self.demand_eqtype(expr.span, expected, ty);
66-
}
67-
6863
pub fn check_expr_has_type_or_error(
6964
&self,
7065
expr: &'tcx hir::Expr<'tcx>,
@@ -331,9 +326,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
331326
}
332327
ExprKind::Cast(e, t) => self.check_expr_cast(e, t, expr),
333328
ExprKind::Type(e, t) => {
334-
let ty = self.to_ty_saving_user_provided_ty(&t);
335-
self.check_expr_eq_type(&e, ty);
336-
ty
329+
let ascribed_ty = self.to_ty_saving_user_provided_ty(&t);
330+
let ty = self.check_expr_with_hint(e, ascribed_ty);
331+
self.demand_eqtype(e.span, ascribed_ty, ty);
332+
ascribed_ty
337333
}
338334
ExprKind::If(cond, then_expr, opt_else_expr) => {
339335
self.check_then_else(cond, then_expr, opt_else_expr, expr.span, expected)

0 commit comments

Comments
 (0)