@@ -45,7 +45,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
45
45
self . note_type_is_not_clone ( err, expected, expr_ty, expr) ;
46
46
self . note_need_for_fn_pointer ( err, expected, expr_ty) ;
47
47
self . note_internal_mutation_in_method ( err, expr, expected, expr_ty) ;
48
- self . report_closure_inferred_return_type ( err, expected) ;
49
48
}
50
49
51
50
// Requires that the two types unify, and prints an error message if
@@ -1418,25 +1417,4 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1418
1417
_ => false ,
1419
1418
}
1420
1419
}
1421
-
1422
- // Report the type inferred by the return statement.
1423
- fn report_closure_inferred_return_type ( & self , err : & mut Diagnostic , expected : Ty < ' tcx > ) {
1424
- if let Some ( sp) = self . ret_coercion_span . get ( )
1425
- // If the closure has an explicit return type annotation, or if
1426
- // the closure's return type has been inferred from outside
1427
- // requirements (such as an Fn* trait bound), then a type error
1428
- // may occur at the first return expression we see in the closure
1429
- // (if it conflicts with the declared return type). Skip adding a
1430
- // note in this case, since it would be incorrect.
1431
- && !self . return_type_pre_known
1432
- {
1433
- err. span_note (
1434
- sp,
1435
- & format ! (
1436
- "return type inferred to be `{}` here" ,
1437
- self . resolve_vars_if_possible( expected)
1438
- ) ,
1439
- ) ;
1440
- }
1441
- }
1442
1420
}
0 commit comments