let fcx = check_fn(ccx, fn_ty.unsafety, id, &fn_sig,
decl, id, body, &inh);
- vtable::select_all_fcx_obligations_or_error(&fcx);
+ vtable::select_all_fcx_obligations_and_apply_defaults(&fcx);
upvar::closure_analyze_fn(&fcx, id, decl, body);
+ vtable::select_all_fcx_obligations_or_error(&fcx);
regionck::regionck_fn(&fcx, id, decl, body);
writeback::resolve_type_vars_in_fn(&fcx, decl, body);
}
}
}
-pub fn select_all_fcx_obligations_or_error(fcx: &FnCtxt) {
+pub fn select_all_fcx_obligations_and_apply_defaults(fcx: &FnCtxt) {
debug!("select_all_fcx_obligations_or_error");
fcx.inh.deferred_resolutions.borrow_mut()
.retain(|r| !r.attempt_resolution(fcx));
-
select_fcx_obligations_where_possible(fcx);
fcx.default_type_parameters();
+ select_fcx_obligations_where_possible(fcx);
+}
+
+pub fn select_all_fcx_obligations_or_error(fcx: &FnCtxt) {
+ debug!("select_all_fcx_obligations_or_error");
+ select_all_fcx_obligations_and_apply_defaults(fcx);
let mut fulfillment_cx = fcx.inh.fulfillment_cx.borrow_mut();
let r = fulfillment_cx.select_all_or_error(fcx.infcx(), fcx);
match r {