]>
Commit | Line | Data |
---|---|---|
487cf647 FG |
1 | type Result<T, E = Error> = ::std::result::Result<T, E>; |
2 | struct Error; | |
3 | ||
4 | trait ForEach { | |
5 | type Input; | |
6 | fn for_each<F, U>(self, f: F) | |
7 | where | |
8 | F: FnOnce(Self::Input) -> U; | |
9 | } | |
10 | ||
11 | impl<T> ForEach for A<T> { | |
12 | type Input = T; | |
13 | fn for_each<F, U>(self, f: F) | |
14 | where | |
15 | F: FnOnce(Self::Input) -> U, | |
16 | { | |
17 | todo!() | |
18 | } | |
19 | } | |
20 | ||
21 | struct A<T>(T); | |
22 | ||
23 | fn main() { | |
24 | let a = A(Result::Ok(Result::Ok(()))); //~ ERROR type annotations needed | |
25 | a.for_each(|a: Result<_>| { | |
26 | let f = || match a { | |
27 | Ok(Ok(a)) => {} | |
28 | Ok(Err(a)) => {} | |
29 | Err(a) => {} | |
30 | }; | |
31 | }); | |
32 | } |