- .with_opaque_type_inference(DefiningAnchor::Bind(hir_owner.def_id))
- .with_normalize_fn_sig_for_diagnostic(Lrc::new(move |infcx, fn_sig| {
- if fn_sig.has_escaping_bound_vars() {
- return fn_sig;
- }
- infcx.probe(|_| {
- let ocx = ObligationCtxt::new_in_snapshot(infcx);
- let normalized_fn_sig = ocx.normalize(
- ObligationCause::dummy(),
- // FIXME(compiler-errors): This is probably not the right param-env...
- infcx.tcx.param_env(def_id),
- fn_sig,
- );
- if ocx.select_all_or_error().is_empty() {
- let normalized_fn_sig =
- infcx.resolve_vars_if_possible(normalized_fn_sig);
- if !normalized_fn_sig.needs_infer() {
- return normalized_fn_sig;
- }
- }
- fn_sig
- })
- })),