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