normalize inherent associated types after substitution

This commit is contained in:
León Orell Valerian Liehr 2022-12-05 18:02:47 +01:00
parent 203c8765ea
commit d5cb5fb185
No known key found for this signature in database
GPG Key ID: CD75E31CE2CFD7D9
3 changed files with 45 additions and 0 deletions

View File

@ -1930,6 +1930,7 @@ pub fn associated_path_to_ty(
adt_substs,
);
let ty = tcx.bound_type_of(assoc_ty_did).subst(tcx, item_substs);
let ty = self.normalize_ty(span, ty);
return Ok((ty, DefKind::AssocTy, assoc_ty_did));
}
}

View File

@ -0,0 +1,22 @@
// check-pass
#![feature(inherent_associated_types)]
#![allow(incomplete_features)]
struct S<T>(T);
impl<T: O> S<T> {
type P = <T as O>::P;
}
trait O {
type P;
}
impl O for i32 {
type P = String;
}
fn main() {
let _: S<i32>::P = String::new();
}

View File

@ -0,0 +1,22 @@
// check-pass
#![feature(inherent_associated_types)]
#![allow(incomplete_features)]
struct S;
impl S {
type P<T: O> = <T as O>::P;
}
trait O {
type P;
}
impl O for i32 {
type P = String;
}
fn main() {
let _: S::P<i32> = String::new();
}