diff options
author | SoniEx2 <endermoneymod@gmail.com> | 2021-03-23 12:21:12 -0300 |
---|---|---|
committer | SoniEx2 <endermoneymod@gmail.com> | 2021-03-23 12:21:12 -0300 |
commit | 36ca2f59cb1dbd6e63fafaddb76b25c260b44a98 (patch) | |
tree | 9c6e4ff47e122681bbf5474f741c8c4d53c6489c /tests/10-multiple-traits-with-generics.rs | |
parent | 0a3c097339d3448f8dcab9aa3c0a9b1345e5cebd (diff) |
Fix generics with multiple impl trait in a row
Diffstat (limited to 'tests/10-multiple-traits-with-generics.rs')
-rw-r--r-- | tests/10-multiple-traits-with-generics.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/10-multiple-traits-with-generics.rs b/tests/10-multiple-traits-with-generics.rs new file mode 100644 index 0000000..f302f11 --- /dev/null +++ b/tests/10-multiple-traits-with-generics.rs @@ -0,0 +1,26 @@ +// Checks that multiple `impl trait` in a row are valid, with generics. + +use impl_trait::impl_trait; + +struct Foo<T>(T); +trait Bar { +} +trait Baz { +} + +impl_trait! { + impl<T> Foo<T> { + impl trait Bar { + } + impl trait Baz { + } + } +} + +fn static_assert_1<T: Bar>(_t: T) {} +fn static_assert_2<T: Baz>(_t: T) {} + +fn main() { + static_assert_1(Foo(())); + static_assert_2(Foo(())); +} |