From a51798a27ba215307dddd3ecc2bfc73f9f08efa9 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Sat, 16 Oct 2021 01:38:49 +0900 Subject: [PATCH] Add some GATs related regression tests --- .../generic-associated-types/issue-88287.rs | 39 +++++++++++++++++++ .../generic-associated-types/issue-88405.rs | 16 ++++++++ 2 files changed, 55 insertions(+) create mode 100644 src/test/ui/generic-associated-types/issue-88287.rs create mode 100644 src/test/ui/generic-associated-types/issue-88405.rs diff --git a/src/test/ui/generic-associated-types/issue-88287.rs b/src/test/ui/generic-associated-types/issue-88287.rs new file mode 100644 index 0000000000000..2e65af594a6bd --- /dev/null +++ b/src/test/ui/generic-associated-types/issue-88287.rs @@ -0,0 +1,39 @@ +// check-pass +// edition:2018 + +#![feature(generic_associated_types)] +#![feature(type_alias_impl_trait)] + +use std::future::Future; + +trait SearchableResource { + type SearchResult; +} + +trait SearchableResourceExt: SearchableResource { + type Future<'f, A: 'f + ?Sized, B: 'f>: Future, ()>> + 'f + where + A: SearchableResource; + + fn search<'c>(&'c self, client: &'c ()) -> Self::Future<'c, Self, Criteria>; +} + +type SearchFutureTy<'f, A, B: 'f> +where + A: SearchableResource + ?Sized + 'f, += impl Future, ()>> + 'f; +impl SearchableResourceExt for T +where + T: SearchableResource, +{ + type Future<'f, A, B: 'f> + where + A: SearchableResource + ?Sized + 'f, + = SearchFutureTy<'f, A, B>; + + fn search<'c>(&'c self, _client: &'c ()) -> Self::Future<'c, Self, Criteria> { + async move { todo!() } + } +} + +fn main() {} diff --git a/src/test/ui/generic-associated-types/issue-88405.rs b/src/test/ui/generic-associated-types/issue-88405.rs new file mode 100644 index 0000000000000..4a405bd3625c1 --- /dev/null +++ b/src/test/ui/generic-associated-types/issue-88405.rs @@ -0,0 +1,16 @@ +// check-pass + +#![feature(generic_associated_types)] + +trait SomeTrait {} +trait OtherTrait { + type Item; +} + +trait ErrorSimpleExample { + type AssociatedType: SomeTrait; + type GatBounded; + type ErrorMinimal: OtherTrait>; +} + +fn main() {}