Skip to content

Commit c7330c9

Browse files
Also check that fn pointer candidates don't have escaping bound vars
1 parent 8927135 commit c7330c9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

compiler/rustc_trait_selection/src/traits/select/confirmation.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
606606
debug!(?obligation, "confirm_fn_pointer_candidate");
607607

608608
// Okay to skip binder; it is reintroduced below.
609-
let self_ty = self.infcx.shallow_resolve(obligation.self_ty().skip_binder());
609+
let self_ty = self
610+
.infcx
611+
.shallow_resolve(obligation.self_ty().no_bound_vars())
612+
.expect("fn pointer should not capture bound vars from predicate");
610613
let sig = self_ty.fn_sig(self.tcx());
611614
let trait_ref = closure_trait_ref_and_return_type(
612615
self.tcx(),

0 commit comments

Comments
 (0)