Skip to content

Commit 4fa5d6e

Browse files
authored
Rollup merge of rust-lang#89918 - JohnTitor:gats-tests, r=jackh726
Add some GATs related regression tests Closes rust-lang#88287, closes rust-lang#88405
2 parents 502d57b + a51798a commit 4fa5d6e

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// check-pass
2+
// edition:2018
3+
4+
#![feature(generic_associated_types)]
5+
#![feature(type_alias_impl_trait)]
6+
7+
use std::future::Future;
8+
9+
trait SearchableResource<Criteria> {
10+
type SearchResult;
11+
}
12+
13+
trait SearchableResourceExt<Criteria>: SearchableResource<Criteria> {
14+
type Future<'f, A: 'f + ?Sized, B: 'f>: Future<Output = Result<Vec<A::SearchResult>, ()>> + 'f
15+
where
16+
A: SearchableResource<B>;
17+
18+
fn search<'c>(&'c self, client: &'c ()) -> Self::Future<'c, Self, Criteria>;
19+
}
20+
21+
type SearchFutureTy<'f, A, B: 'f>
22+
where
23+
A: SearchableResource<B> + ?Sized + 'f,
24+
= impl Future<Output = Result<Vec<A::SearchResult>, ()>> + 'f;
25+
impl<T, Criteria> SearchableResourceExt<Criteria> for T
26+
where
27+
T: SearchableResource<Criteria>,
28+
{
29+
type Future<'f, A, B: 'f>
30+
where
31+
A: SearchableResource<B> + ?Sized + 'f,
32+
= SearchFutureTy<'f, A, B>;
33+
34+
fn search<'c>(&'c self, _client: &'c ()) -> Self::Future<'c, Self, Criteria> {
35+
async move { todo!() }
36+
}
37+
}
38+
39+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// check-pass
2+
3+
#![feature(generic_associated_types)]
4+
5+
trait SomeTrait {}
6+
trait OtherTrait {
7+
type Item;
8+
}
9+
10+
trait ErrorSimpleExample {
11+
type AssociatedType: SomeTrait;
12+
type GatBounded<T: SomeTrait>;
13+
type ErrorMinimal: OtherTrait<Item = Self::GatBounded<Self::AssociatedType>>;
14+
}
15+
16+
fn main() {}

0 commit comments

Comments
 (0)