diff options
author | SoniEx2 <endermoneymod@gmail.com> | 2021-08-13 00:35:41 -0300 |
---|---|---|
committer | SoniEx2 <endermoneymod@gmail.com> | 2021-08-13 00:35:41 -0300 |
commit | 5cf5f84335c759338f993175fbbdc8bfba7fb5d3 (patch) | |
tree | 7887fe972ce4baa5c58947b2cf27a55c1079fe27 /tests/14-where-on-trait.rs | |
parent | bffdb1e7ad54b0b857d69d45b8791c68741a6ea0 (diff) |
Fix `impl trait where` without `impl where`
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(()), ()); +} |