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 +++++++++++++++++++++++++ tests/progress.rs | 1 + 2 files changed, 26 insertions(+) create mode 100644 tests/14-where-on-trait.rs (limited to 'tests') 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(()), ()); +} diff --git a/tests/progress.rs b/tests/progress.rs index ef302b0..1cece81 100644 --- a/tests/progress.rs +++ b/tests/progress.rs @@ -14,6 +14,7 @@ fn tests() { t.pass("tests/11-traits-generics-docs.rs"); t.pass("tests/12-combining-generics.rs"); t.pass("tests/13-trait-generics.rs"); + t.pass("tests/14-where-on-trait.rs"); t.pass("tests/98-readme.rs"); t.pass("tests/99-goal.rs"); } -- cgit 1.4.1