From 36ca2f59cb1dbd6e63fafaddb76b25c260b44a98 Mon Sep 17 00:00:00 2001 From: SoniEx2 Date: Tue, 23 Mar 2021 12:21:12 -0300 Subject: Fix generics with multiple impl trait in a row --- tests/10-multiple-traits-with-generics.rs | 26 ++++++++++++++++++++++++++ tests/progress.rs | 1 + 2 files changed, 27 insertions(+) create mode 100644 tests/10-multiple-traits-with-generics.rs (limited to 'tests') 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); +trait Bar { +} +trait Baz { +} + +impl_trait! { + impl Foo { + impl trait Bar { + } + impl trait Baz { + } + } +} + +fn static_assert_1(_t: T) {} +fn static_assert_2(_t: T) {} + +fn main() { + static_assert_1(Foo(())); + static_assert_2(Foo(())); +} diff --git a/tests/progress.rs b/tests/progress.rs index 22110b0..74c5774 100644 --- a/tests/progress.rs +++ b/tests/progress.rs @@ -10,6 +10,7 @@ fn tests() { t.pass("tests/07-docs.rs"); t.pass("tests/08-inherent-docs.rs"); t.pass("tests/09-multiple-traits.rs"); + t.pass("tests/10-multiple-traits-with-generics.rs"); t.pass("tests/98-readme.rs"); t.pass("tests/99-goal.rs"); } -- cgit 1.4.1