1
Fork 0

Rollup merge of #102378 - compiler-errors:issue-102289, r=jackh726

Use already resolved `self_ty` in `confirm_fn_pointer_candidate`

Fixes #102289
This commit is contained in:
Yuki Okushi 2022-09-28 13:07:20 +09:00 committed by GitHub
commit ae2028817a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 56 additions and 1 deletions

View file

@ -626,7 +626,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
// the signature, as evidenced by how we treat it during projection.
// The safe thing to do here is to liberate it, though, which should
// have no worse effect than skipping the binder here.
let liberated_fn_ty = self.infcx.replace_bound_vars_with_placeholders(obligation.self_ty());
let liberated_fn_ty =
self.infcx.replace_bound_vars_with_placeholders(obligation.predicate.rebind(self_ty));
let output_ty = self
.infcx
.replace_bound_vars_with_placeholders(liberated_fn_ty.fn_sig(self.tcx()).output());