about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-11-24 19:37:03 +0000
committerMichael Goulet <michael@errs.io>2022-11-24 21:50:04 +0000
commitc7330c9fe82b698831105fd31f611fb46586fd3c (patch)
tree19015ba939536748d8f8a225d1d51f689e28cff6 /compiler
parent89271352741e54c08c89fe19b6832666a29a932d (diff)
downloadrust-c7330c9fe82b698831105fd31f611fb46586fd3c.tar.gz
rust-c7330c9fe82b698831105fd31f611fb46586fd3c.zip
Also check that fn pointer candidates don't have escaping bound vars
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_trait_selection/src/traits/select/confirmation.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs
index 8f473ebb452..db0f230cf8d 100644
--- a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs
@@ -606,7 +606,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
         debug!(?obligation, "confirm_fn_pointer_candidate");
 
         // Okay to skip binder; it is reintroduced below.
-        let self_ty = self.infcx.shallow_resolve(obligation.self_ty().skip_binder());
+        let self_ty = self
+            .infcx
+            .shallow_resolve(obligation.self_ty().no_bound_vars())
+            .expect("fn pointer should not capture bound vars from predicate");
         let sig = self_ty.fn_sig(self.tcx());
         let trait_ref = closure_trait_ref_and_return_type(
             self.tcx(),