Skip to content

Commit 4484165

Browse files
authored
Rollup merge of #93362 - compiler-errors:ice-gat-in-rpit, r=oli-obk
Do not register infer var for GAT projection in RPIT Fixes #93340 Fixes #91603 r? ```@oli-obk```
2 parents 103c3a3 + c6f6e3e commit 4484165

File tree

2 files changed

+29
-7
lines changed

2 files changed

+29
-7
lines changed

compiler/rustc_infer/src/infer/opaque_types.rs

+9-7
Original file line numberDiff line numberDiff line change
@@ -569,13 +569,15 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
569569
let predicate = predicate.fold_with(&mut BottomUpFolder {
570570
tcx,
571571
ty_op: |ty| match ty.kind() {
572-
ty::Projection(projection_ty) => infcx.infer_projection(
573-
self.param_env,
574-
*projection_ty,
575-
traits::ObligationCause::misc(self.value_span, self.body_id),
576-
0,
577-
&mut self.obligations,
578-
),
572+
ty::Projection(projection_ty) if !projection_ty.has_escaping_bound_vars() => {
573+
infcx.infer_projection(
574+
self.param_env,
575+
*projection_ty,
576+
traits::ObligationCause::misc(self.value_span, self.body_id),
577+
0,
578+
&mut self.obligations,
579+
)
580+
}
579581
_ => ty,
580582
},
581583
lt_op: |lt| lt,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// check-pass
2+
3+
#![feature(generic_associated_types)]
4+
5+
pub trait Scalar: 'static {
6+
type RefType<'a>: ScalarRef<'a>;
7+
}
8+
9+
pub trait ScalarRef<'a>: 'a {}
10+
11+
fn cmp_eq<'a, 'b, A: Scalar, B: Scalar, O: Scalar>(a: A::RefType<'a>, b: B::RefType<'b>) -> O {
12+
todo!()
13+
}
14+
15+
fn build_expression<A: Scalar, B: Scalar, O: Scalar>(
16+
) -> impl Fn(A::RefType<'_>, B::RefType<'_>) -> O {
17+
cmp_eq
18+
}
19+
20+
fn main() {}

0 commit comments

Comments
 (0)