Skip to content

Commit 3c33244

Browse files
authored
Rollup merge of rust-lang#105315 - fmease:norm-subst-iat, r=compiler-errors
Normalize inherent associated types after substitution Fixes rust-lang#105314. r? `@cjgillot` (rust-lang#105224) `@rustbot` label F-inherent_associated_types
2 parents 151516e + d5cb5fb commit 3c33244

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

compiler/rustc_hir_analysis/src/astconv/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1930,6 +1930,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
19301930
adt_substs,
19311931
);
19321932
let ty = tcx.bound_type_of(assoc_ty_did).subst(tcx, item_substs);
1933+
let ty = self.normalize_ty(span, ty);
19331934
return Ok((ty, DefKind::AssocTy, assoc_ty_did));
19341935
}
19351936
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// check-pass
2+
3+
#![feature(inherent_associated_types)]
4+
#![allow(incomplete_features)]
5+
6+
struct S<T>(T);
7+
8+
impl<T: O> S<T> {
9+
type P = <T as O>::P;
10+
}
11+
12+
trait O {
13+
type P;
14+
}
15+
16+
impl O for i32 {
17+
type P = String;
18+
}
19+
20+
fn main() {
21+
let _: S<i32>::P = String::new();
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// check-pass
2+
3+
#![feature(inherent_associated_types)]
4+
#![allow(incomplete_features)]
5+
6+
struct S;
7+
8+
impl S {
9+
type P<T: O> = <T as O>::P;
10+
}
11+
12+
trait O {
13+
type P;
14+
}
15+
16+
impl O for i32 {
17+
type P = String;
18+
}
19+
20+
fn main() {
21+
let _: S::P<i32> = String::new();
22+
}

0 commit comments

Comments
 (0)