From 5cf5f84335c759338f993175fbbdc8bfba7fb5d3 Mon Sep 17 00:00:00 2001 From: SoniEx2 Date: Fri, 13 Aug 2021 00:35:41 -0300 Subject: Fix `impl trait where` without `impl where` --- tests/14-where-on-trait.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tests/14-where-on-trait.rs (limited to 'tests/14-where-on-trait.rs') 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); +trait Bar { +} + +impl_trait! { + impl Foo { + impl trait Bar where Self: From { + } + } +} +impl From<()> for Foo<()> { + fn from(x: ()) -> Self { + Self { 0: x } + } +} + +fn static_assert_1, U>(_t: T, _u: U) {} + +fn main() { + static_assert_1(Foo(()), ()); +} -- cgit 1.4.1