Rollup merge of #105315 - fmease:norm-subst-iat, r=compiler-errors
Normalize inherent associated types after substitution Fixes #105314. r? ````@cjgillot```` (#105224) ````@rustbot```` label F-inherent_associated_types
This commit is contained in:
commit
7ba37adbfd
@ -1930,6 +1930,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||||||
adt_substs,
|
adt_substs,
|
||||||
);
|
);
|
||||||
let ty = tcx.bound_type_of(assoc_ty_did).subst(tcx, item_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));
|
return Ok((ty, DefKind::AssocTy, assoc_ty_did));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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();
|
||||||
|
}
|
@ -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();
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user