Skip to content

Commit f3589a7

Browse files
Inline check_expr_meets_expectation_or_error
1 parent 6868b93 commit f3589a7

File tree

1 file changed

+3
-13
lines changed
  • compiler/rustc_hir_typeck/src

1 file changed

+3
-13
lines changed

compiler/rustc_hir_typeck/src/expr.rs

+3-13
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
6868
pub fn check_expr_has_type_or_error(
6969
&self,
7070
expr: &'tcx hir::Expr<'tcx>,
71-
expected: Ty<'tcx>,
72-
extend_err: impl FnMut(&mut Diagnostic),
73-
) -> Ty<'tcx> {
74-
self.check_expr_meets_expectation_or_error(expr, ExpectHasType(expected), extend_err)
75-
}
76-
77-
fn check_expr_meets_expectation_or_error(
78-
&self,
79-
expr: &'tcx hir::Expr<'tcx>,
80-
expected: Expectation<'tcx>,
81-
mut extend_err: impl FnMut(&mut Diagnostic),
71+
expected_ty: Ty<'tcx>,
72+
extend_err: impl FnOnce(&mut Diagnostic),
8273
) -> Ty<'tcx> {
83-
let expected_ty = expected.to_option(&self).unwrap_or(self.tcx.types.bool);
84-
let mut ty = self.check_expr_with_expectation(expr, expected);
74+
let mut ty = self.check_expr_with_expectation(expr, ExpectHasType(expected_ty));
8575

8676
// While we don't allow *arbitrary* coercions here, we *do* allow
8777
// coercions from ! to `expected`.

0 commit comments

Comments
 (0)