test: add test for #4257

This commit is contained in:
Eric 2021-08-30 21:09:21 +12:00 committed by Caleb Cartwright
parent d19f69cd71
commit 33d1368674
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,13 @@
#![feature(generic_associated_types)]
#![allow(incomplete_features)]
trait Trait<T> {
type Type<'a> where T: 'a;
fn foo(x: &T) -> Self::Type<'_>;
}
impl<T> Trait<T> for () {
type Type<'a> where T: 'a = &'a T;
fn foo(x: &T) -> Self::Type<'_> {
x
}
}

View File

@ -0,0 +1,18 @@
#![feature(generic_associated_types)]
#![allow(incomplete_features)]
trait Trait<T> {
type Type<'a>
where
T: 'a;
fn foo(x: &T) -> Self::Type<'_>;
}
impl<T> Trait<T> for () {
type Type<'a>
where
T: 'a,
= &'a T;
fn foo(x: &T) -> Self::Type<'_> {
x
}
}