Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some GATs related regression tests #89918

Merged
merged 1 commit into from
Oct 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/test/ui/generic-associated-types/issue-88287.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// check-pass
// edition:2018

#![feature(generic_associated_types)]
#![feature(type_alias_impl_trait)]

use std::future::Future;

trait SearchableResource<Criteria> {
type SearchResult;
}

trait SearchableResourceExt<Criteria>: SearchableResource<Criteria> {
type Future<'f, A: 'f + ?Sized, B: 'f>: Future<Output = Result<Vec<A::SearchResult>, ()>> + 'f
where
A: SearchableResource<B>;

fn search<'c>(&'c self, client: &'c ()) -> Self::Future<'c, Self, Criteria>;
}

type SearchFutureTy<'f, A, B: 'f>
where
A: SearchableResource<B> + ?Sized + 'f,
= impl Future<Output = Result<Vec<A::SearchResult>, ()>> + 'f;
impl<T, Criteria> SearchableResourceExt<Criteria> for T
where
T: SearchableResource<Criteria>,
{
type Future<'f, A, B: 'f>
where
A: SearchableResource<B> + ?Sized + 'f,
= SearchFutureTy<'f, A, B>;

fn search<'c>(&'c self, _client: &'c ()) -> Self::Future<'c, Self, Criteria> {
async move { todo!() }
}
}

fn main() {}
16 changes: 16 additions & 0 deletions src/test/ui/generic-associated-types/issue-88405.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// check-pass

#![feature(generic_associated_types)]

trait SomeTrait {}
trait OtherTrait {
type Item;
}

trait ErrorSimpleExample {
type AssociatedType: SomeTrait;
type GatBounded<T: SomeTrait>;
type ErrorMinimal: OtherTrait<Item = Self::GatBounded<Self::AssociatedType>>;
}

fn main() {}