1
Fork 0

Rollup merge of #89918 - JohnTitor:gats-tests, r=jackh726

Add some GATs related regression tests

Closes #88287, closes #88405
This commit is contained in:
Matthias Krüger 2021-10-16 08:02:26 +02:00 committed by GitHub
commit 4fa5d6e5f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 55 additions and 0 deletions

View file

@ -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() {}

View file

@ -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() {}