]> git.proxmox.com Git - rustc.git/blame - src/test/ui/traits/issue-43132.rs
New upstream version 1.67.1+dfsg1
[rustc.git] / src / test / ui / traits / issue-43132.rs
CommitLineData
b7449926 1// run-pass
3b2f2976
XL
2#![allow(unused)]
3
4fn main() {
5}
6
7fn foo() {
8 let b = mk::<
dc9dc135 9 Forward<(Box<dyn Future<Error = u32>>,)>,
3b2f2976
XL
10 >();
11 b.map_err(|_| ()).join();
12}
13
14fn mk<T>() -> T {
15 loop {}
16}
17
18impl<I: Future<Error = E>, E> Future for (I,) {
19 type Error = E;
20}
21
22struct Forward<T: Future> {
23 _a: T,
24}
25
26impl<T: Future> Future for Forward<T>
27where
28 T::Error: From<u32>,
29{
30 type Error = T::Error;
31}
32
33trait Future {
34 type Error;
35
36 fn map_err<F, E>(self, _: F) -> (Self, F)
37 where
38 F: FnOnce(Self::Error) -> E,
39 Self: Sized,
40 {
41 loop {}
42 }
43
44 fn join(self) -> (MaybeDone<Self>, ())
45 where
46 Self: Sized,
47 {
48 loop {}
49 }
50}
51
52impl<S: ?Sized + Future> Future for Box<S> {
53 type Error = S::Error;
54}
55
56enum MaybeDone<A: Future> {
57 _Done(A::Error),
58}
59
60impl<U, A: Future, F> Future for (A, F)
61where
62 F: FnOnce(A::Error) -> U,
63{
64 type Error = U;
65}