@@ -60,11 +60,6 @@ use rustc_trait_selection::traits::ObligationCtxt;
60
60
use rustc_trait_selection:: traits:: { self , ObligationCauseCode } ;
61
61
62
62
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
-
68
63
pub fn check_expr_has_type_or_error (
69
64
& self ,
70
65
expr : & ' tcx hir:: Expr < ' tcx > ,
@@ -331,9 +326,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
331
326
}
332
327
ExprKind :: Cast ( e, t) => self . check_expr_cast ( e, t, expr) ,
333
328
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
337
333
}
338
334
ExprKind :: If ( cond, then_expr, opt_else_expr) => {
339
335
self . check_then_else ( cond, then_expr, opt_else_expr, expr. span , expected)
0 commit comments