normalize the self-type that we extract from impl
This commit is contained in:
parent
f5cc7dba8a
commit
9a7bb0ef24
2 changed files with 26 additions and 0 deletions
|
|
@ -1019,6 +1019,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
|
|||
{
|
||||
let impl_self_ty = tcx.type_of(impl_def_id);
|
||||
let impl_self_ty = impl_self_ty.subst(tcx, &substs);
|
||||
let impl_self_ty = self.normalize(impl_self_ty, locations);
|
||||
|
||||
// There may be type variables in `substs` and hence
|
||||
// in `impl_self_ty`, but they should all have been
|
||||
|
|
|
|||
25
src/test/ui/nll/user-annotations/normalize-self-ty.rs
Normal file
25
src/test/ui/nll/user-annotations/normalize-self-ty.rs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
// Regression test for #55183: check a case where the self type from
|
||||
// the inherent impl requires normalization to be equal to the
|
||||
// user-provided type.
|
||||
//
|
||||
// run-pass
|
||||
|
||||
#![feature(nll)]
|
||||
|
||||
trait Mirror {
|
||||
type Me;
|
||||
}
|
||||
|
||||
impl<T> Mirror for T {
|
||||
type Me = T;
|
||||
}
|
||||
|
||||
struct Foo<A, B>(A, B);
|
||||
|
||||
impl<A> Foo<A, <A as Mirror>::Me> {
|
||||
fn m(b: A) { }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
<Foo<&'static u32, &u32>>::m(&22);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue