diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/14-where-on-trait.rs | 25 | ||||
-rw-r--r-- | tests/progress.rs | 1 |
2 files changed, 26 insertions, 0 deletions
diff --git a/tests/14-where-on-trait.rs b/tests/14-where-on-trait.rs new file mode 100644 index 0000000..56c7a4a --- /dev/null +++ b/tests/14-where-on-trait.rs @@ -0,0 +1,25 @@ +// Checks that the impl trait can have where. + +use impl_trait::impl_trait; + +struct Foo<T>(T); +trait Bar<U> { +} + +impl_trait! { + impl<T> Foo<T> { + impl trait<U> Bar<U> where Self: From<U> { + } + } +} +impl From<()> for Foo<()> { + fn from(x: ()) -> Self { + Self { 0: x } + } +} + +fn static_assert_1<T: Bar<U>, U>(_t: T, _u: U) {} + +fn main() { + static_assert_1(Foo(()), ()); +} diff --git a/tests/progress.rs b/tests/progress.rs index ef302b0..1cece81 100644 --- a/tests/progress.rs +++ b/tests/progress.rs @@ -14,6 +14,7 @@ fn tests() { t.pass("tests/11-traits-generics-docs.rs"); t.pass("tests/12-combining-generics.rs"); t.pass("tests/13-trait-generics.rs"); + t.pass("tests/14-where-on-trait.rs"); t.pass("tests/98-readme.rs"); t.pass("tests/99-goal.rs"); } |