summary refs log tree commit diff stats
path: root/tests/09-multiple-traits.rs
diff options
context:
space:
mode:
authorSoniEx2 <endermoneymod@gmail.com>2021-03-23 12:08:50 -0300
committerSoniEx2 <endermoneymod@gmail.com>2021-03-23 12:08:50 -0300
commit0a3c097339d3448f8dcab9aa3c0a9b1345e5cebd (patch)
tree6831816f1ba78c8ba3c313ede338afc177c1834d /tests/09-multiple-traits.rs
parent56a744b412a1ecb3f3875998d959d518287bcc95 (diff)
Fix bug preventing multiple impl trait in a row
Diffstat (limited to 'tests/09-multiple-traits.rs')
-rw-r--r--tests/09-multiple-traits.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/09-multiple-traits.rs b/tests/09-multiple-traits.rs
new file mode 100644
index 0000000..d75ab31
--- /dev/null
+++ b/tests/09-multiple-traits.rs
@@ -0,0 +1,26 @@
+// Checks that multiple `impl trait` in a row are valid.
+
+use impl_trait::impl_trait;
+
+struct Foo;
+trait Bar {
+}
+trait Baz {
+}
+
+impl_trait! {
+    impl Foo {
+        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);
+}