diff options
Diffstat (limited to 'tests/14-where-on-trait.rs')
-rw-r--r-- | tests/14-where-on-trait.rs | 25 |
1 files changed, 25 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(()), ()); +} |