Skip to content

Commit

Permalink
test: add test for #4257
Browse files Browse the repository at this point in the history
  • Loading branch information
cowboy-bebug authored and calebcartwright committed Sep 3, 2021
1 parent d19f69c commit 33d1368
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/source/issue_4257.rs
Original file line number Diff line number Diff line change
@@ -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
}
}
18 changes: 18 additions & 0 deletions tests/target/issue_4257.rs
Original file line number Diff line number Diff line change
@@ -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
}
}

0 comments on commit 33d1368

Please sign in to comment.