Skip to content

Commit 9a7bb0e

Browse files
committed
normalize the self-type that we extract from impl
1 parent f5cc7db commit 9a7bb0e

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/librustc_mir/borrow_check/nll/type_check/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1019,6 +1019,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
10191019
{
10201020
let impl_self_ty = tcx.type_of(impl_def_id);
10211021
let impl_self_ty = impl_self_ty.subst(tcx, &substs);
1022+
let impl_self_ty = self.normalize(impl_self_ty, locations);
10221023

10231024
// There may be type variables in `substs` and hence
10241025
// in `impl_self_ty`, but they should all have been
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Regression test for #55183: check a case where the self type from
2+
// the inherent impl requires normalization to be equal to the
3+
// user-provided type.
4+
//
5+
// run-pass
6+
7+
#![feature(nll)]
8+
9+
trait Mirror {
10+
type Me;
11+
}
12+
13+
impl<T> Mirror for T {
14+
type Me = T;
15+
}
16+
17+
struct Foo<A, B>(A, B);
18+
19+
impl<A> Foo<A, <A as Mirror>::Me> {
20+
fn m(b: A) { }
21+
}
22+
23+
fn main() {
24+
<Foo<&'static u32, &u32>>::m(&22);
25+
}

0 commit comments

Comments
 (0)