debug!(?bound_sig, ?liberated_sig);
+ let mut fcx = FnCtxt::new(self, self.param_env.without_const(), body.value.hir_id);
let generator_types = check_fn(
- self,
- self.param_env.without_const(),
+ &mut fcx,
liberated_sig,
closure.fn_decl,
expr_def_id,
body,
closure.movability,
- )
- .1;
+ );
let parent_substs = InternalSubsts::identity_for_item(
self.tcx,
if expected_sig.is_none()
&& let ty::PredicateKind::Clause(ty::Clause::Projection(proj_predicate)) = bound_predicate.skip_binder()
{
- expected_sig = self.normalize_associated_types_in(
+ expected_sig = self.normalize(
obligation.cause.span,
self.deduce_sig_from_projection(
Some(obligation.cause.span),
.iter()
.map(|ty| ArgKind::from_expected_ty(*ty, None))
.collect();
- let (closure_span, found_args) = match self.get_fn_like_arguments(expr_map_node) {
- Some((sp, args)) => (Some(sp), args),
- None => (None, Vec::new()),
- };
+ let (closure_span, closure_arg_span, found_args) =
+ match self.get_fn_like_arguments(expr_map_node) {
+ Some((sp, arg_sp, args)) => (Some(sp), arg_sp, args),
+ None => (None, None, Vec::new()),
+ };
let expected_span =
expected_sig.cause_span.unwrap_or_else(|| self.tcx.def_span(expr_def_id));
self.report_arg_count_mismatch(
expected_args,
found_args,
true,
+ closure_arg_span,
)
.emit();
);
// Astconv can't normalize inputs or outputs with escaping bound vars,
// so normalize them here, after we've wrapped them in a binder.
- let result = self.normalize_associated_types_in(self.tcx.hir().span(hir_id), result);
+ let result = self.normalize(self.tcx.hir().span(hir_id), result);
let c_result = self.inh.infcx.canonicalize_response(result);
self.typeck_results.borrow_mut().user_provided_sigs.insert(expr_def_id, c_result);
) -> ClosureSignatures<'tcx> {
let liberated_sig =
self.tcx().liberate_late_bound_regions(expr_def_id.to_def_id(), bound_sig);
- let liberated_sig = self.inh.normalize_associated_types_in(
- body.value.span,
- self.tcx.hir().local_def_id_to_hir_id(expr_def_id),
- self.param_env,
- liberated_sig,
- );
+ let liberated_sig = self.normalize(body.value.span, liberated_sig);
ClosureSignatures { bound_sig, liberated_sig }
}
}