mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
do not register infer var for GAT projection in opaque
This commit is contained in:
parent
563250a65c
commit
c6f6e3e0e9
@ -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,
|
||||
|
20
src/test/ui/generic-associated-types/issue-93340.rs
Normal file
20
src/test/ui/generic-associated-types/issue-93340.rs
Normal file
@ -0,0 +1,20 @@
|
||||
// check-pass
|
||||
|
||||
#![feature(generic_associated_types)]
|
||||
|
||||
pub trait Scalar: 'static {
|
||||
type RefType<'a>: ScalarRef<'a>;
|
||||
}
|
||||
|
||||
pub trait ScalarRef<'a>: 'a {}
|
||||
|
||||
fn cmp_eq<'a, 'b, A: Scalar, B: Scalar, O: Scalar>(a: A::RefType<'a>, b: B::RefType<'b>) -> O {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn build_expression<A: Scalar, B: Scalar, O: Scalar>(
|
||||
) -> impl Fn(A::RefType<'_>, B::RefType<'_>) -> O {
|
||||
cmp_eq
|
||||
}
|
||||
|
||||
fn main() {}
|
Loading…
Reference in New Issue
Block a user