about summary refs log tree commit diff
path: root/compiler/rustc_infer
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-01-26 22:43:07 -0800
committerMichael Goulet <michael@errs.io>2022-01-26 22:45:12 -0800
commitc6f6e3e0e98dad9578df472a33a71d6bdf104666 (patch)
tree822a92f63c258459758ccdd7c3027e77cf1c61d6 /compiler/rustc_infer
parent563250a65c884c6767dc2ee2e2580360d33d561c (diff)
downloadrust-c6f6e3e0e98dad9578df472a33a71d6bdf104666.tar.gz
rust-c6f6e3e0e98dad9578df472a33a71d6bdf104666.zip
do not register infer var for GAT projection in opaque
Diffstat (limited to 'compiler/rustc_infer')
-rw-r--r--compiler/rustc_infer/src/infer/opaque_types.rs16
1 files changed, 9 insertions, 7 deletions
diff --git a/compiler/rustc_infer/src/infer/opaque_types.rs b/compiler/rustc_infer/src/infer/opaque_types.rs
index 4851e637d3a..e7dca94806c 100644
--- a/compiler/rustc_infer/src/infer/opaque_types.rs
+++ b/compiler/rustc_infer/src/infer/opaque_types.rs
@@ -569,13 +569,15 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
             let predicate = predicate.fold_with(&mut BottomUpFolder {
                 tcx,
                 ty_op: |ty| match ty.kind() {
-                    ty::Projection(projection_ty) => infcx.infer_projection(
-                        self.param_env,
-                        *projection_ty,
-                        traits::ObligationCause::misc(self.value_span, self.body_id),
-                        0,
-                        &mut self.obligations,
-                    ),
+                    ty::Projection(projection_ty) if !projection_ty.has_escaping_bound_vars() => {
+                        infcx.infer_projection(
+                            self.param_env,
+                            *projection_ty,
+                            traits::ObligationCause::misc(self.value_span, self.body_id),
+                            0,
+                            &mut self.obligations,
+                        )
+                    }
                     _ => ty,
                 },
                 lt_op: |lt| lt,