@@ -942,29 +942,36 @@ mod demand {
942
942
ty_param_subst_var_ids += [ ty:: ty_var_id ( fcx. ccx . tcx , t_0) ] ;
943
943
simple ( fcx, sp, ty_param_subst, t_0) ;
944
944
}
945
+
946
+ fn mk_result( & @fn_ctxt fcx , & ty:: t result_ty ,
947
+ & vec[ int] ty_param_subst_var_ids ,
948
+ uint implicit_boxes ) -> ty_param_substs_and_ty {
949
+ let vec[ ty:: t] result_ty_param_substs = [ ] ;
950
+ for ( int var_id in ty_param_subst_var_ids) {
951
+ auto tp_subst = ty:: mk_var( fcx. ccx. tcx, var_id) ;
952
+ result_ty_param_substs += [ tp_subst] ;
953
+ }
954
+ ret tup( result_ty_param_substs,
955
+ add_boxes( fcx. ccx, implicit_boxes, result_ty) ) ;
956
+ }
957
+
945
958
alt ( unify:: simple( fcx, expected_1, actual_1) ) {
946
959
case ( ures_ok( ?t) ) {
947
- let vec[ ty:: t] result_ty_param_substs = [ ] ;
948
- for ( int var_id in ty_param_subst_var_ids) {
949
- auto tp_subst = ty:: mk_var( fcx. ccx. tcx, var_id) ;
950
- result_ty_param_substs += [ tp_subst] ;
951
- }
952
- ret tup( result_ty_param_substs,
953
- add_boxes( fcx. ccx, implicit_boxes, t) ) ;
960
+ ret mk_result( fcx, t, ty_param_subst_var_ids,
961
+ implicit_boxes) ;
954
962
}
955
963
case ( ures_err( ?err) ) {
956
964
auto e_err = resolve_type_vars_if_possible( fcx, expected_1) ;
957
965
auto a_err = resolve_type_vars_if_possible( fcx, actual_1) ;
958
- fcx. ccx. tcx. sess. span_fatal ( sp,
966
+ fcx. ccx. tcx. sess. span_err ( sp,
959
967
"mismatched types: expected " +
960
- ty_to_str( fcx. ccx. tcx, e_err) +
961
- " but found " +
962
- ty_to_str( fcx. ccx. tcx, a_err) +
963
- " (" + ty:: type_err_to_str( err)
964
- + ")" ) ;
965
- // TODO: In the future, try returning "expected", reporting
966
- // the error, and continue.
967
-
968
+ ty_to_str( fcx. ccx. tcx, e_err) +
969
+ " but found " +
970
+ ty_to_str( fcx. ccx. tcx, a_err) +
971
+ " (" + ty:: type_err_to_str( err)
972
+ + ")" ) ;
973
+ ret mk_result( fcx, expected_1,
974
+ ty_param_subst_var_ids, implicit_boxes) ;
968
975
}
969
976
}
970
977
}
@@ -2502,6 +2509,7 @@ fn check_crate(&ty::ctxt tcx, &@ast::crate crate) {
2502
2509
rec( visit_item_pre=bind check_item( ccx, _)
2503
2510
with walk:: default_visitor( ) ) ;
2504
2511
walk:: walk_crate( visit, * crate ) ;
2512
+ tcx. sess. abort_if_errors( ) ;
2505
2513
}
2506
2514
//
2507
2515
// Local Variables:
0 commit comments