]> git.lizzy.rs Git - rust.git/blob - src/test/ui/generic-associated-types/issue-91762.rs
Rollup merge of #93613 - crlf0710:rename_to_async_iter, r=yaahc
[rust.git] / src / test / ui / generic-associated-types / issue-91762.rs
1 // check-fail
2
3 // FIXME(generic_associated_types): We almost certaintly want this to pass, but
4 // it's particularly difficult currently, because we need a way of specifying
5 // that `<Self::Base as Functor>::With<T> = Self` without using that when we have
6 // a `U`. See `https://github.com/rust-lang/rust/pull/92728` for a (hacky)
7 // solution. This might be better to just wait for Chalk.
8
9 #![feature(generic_associated_types)]
10
11 pub trait Functor {
12     type With<T>;
13
14     fn fmap<T, U>(this: Self::With<T>) -> Self::With<U>;
15 }
16
17 pub trait FunctorExt<T>: Sized {
18     type Base: Functor<With<T> = Self>;
19
20     fn fmap<U>(self) {
21         let arg: <Self::Base as Functor>::With<T>;
22         let ret: <Self::Base as Functor>::With<U>;
23
24         arg = self;
25         ret = <Self::Base as Functor>::fmap(arg);
26         //~^ type annotations needed
27     }
28 }
29
30 fn main() {}