]>
Commit | Line | Data |
---|---|---|
b7449926 | 1 | // run-pass |
3b2f2976 XL |
2 | #![allow(unused)] |
3 | ||
4 | fn main() { | |
5 | } | |
6 | ||
7 | fn foo() { | |
8 | let b = mk::< | |
dc9dc135 | 9 | Forward<(Box<dyn Future<Error = u32>>,)>, |
3b2f2976 XL |
10 | >(); |
11 | b.map_err(|_| ()).join(); | |
12 | } | |
13 | ||
14 | fn mk<T>() -> T { | |
15 | loop {} | |
16 | } | |
17 | ||
18 | impl<I: Future<Error = E>, E> Future for (I,) { | |
19 | type Error = E; | |
20 | } | |
21 | ||
22 | struct Forward<T: Future> { | |
23 | _a: T, | |
24 | } | |
25 | ||
26 | impl<T: Future> Future for Forward<T> | |
27 | where | |
28 | T::Error: From<u32>, | |
29 | { | |
30 | type Error = T::Error; | |
31 | } | |
32 | ||
33 | trait 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 | ||
52 | impl<S: ?Sized + Future> Future for Box<S> { | |
53 | type Error = S::Error; | |
54 | } | |
55 | ||
56 | enum MaybeDone<A: Future> { | |
57 | _Done(A::Error), | |
58 | } | |
59 | ||
60 | impl<U, A: Future, F> Future for (A, F) | |
61 | where | |
62 | F: FnOnce(A::Error) -> U, | |
63 | { | |
64 | type Error = U; | |
65 | } |