Skip to content

Commit 312c9e6

Browse files
committed
coerce type ascriptions by default
1 parent 6163bfd commit 312c9e6

File tree

1 file changed

+1
-6
lines changed
  • compiler/rustc_typeck/src/check

1 file changed

+1
-6
lines changed

compiler/rustc_typeck/src/check/expr.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,6 @@ use rustc_trait_selection::traits::{self, ObligationCauseCode};
4848
use std::fmt::Display;
4949

5050
impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
51-
fn check_expr_eq_type(&self, expr: &'tcx hir::Expr<'tcx>, expected: Ty<'tcx>) {
52-
let ty = self.check_expr_with_hint(expr, expected);
53-
self.demand_eqtype(expr.span, expected, ty);
54-
}
55-
5651
pub fn check_expr_has_type_or_error(
5752
&self,
5853
expr: &'tcx hir::Expr<'tcx>,
@@ -282,7 +277,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
282277
ExprKind::Cast(ref e, ref t) => self.check_expr_cast(e, t, expr),
283278
ExprKind::Type(ref e, ref t) => {
284279
let ty = self.to_ty_saving_user_provided_ty(&t);
285-
self.check_expr_eq_type(&e, ty);
280+
self.check_expr_coercable_to_type(e, ty, None);
286281
ty
287282
}
288283
ExprKind::DropTemps(ref e) => self.check_expr_with_expectation(e, expected),

0 commit comments

Comments
 (0)