]> git.lizzy.rs Git - rust.git/blob - src/test/ui/try-poll.rs
Stabilize futures_api
[rust.git] / src / test / ui / try-poll.rs
1 // compile-pass
2
3 #![allow(dead_code, unused)]
4
5 use std::task::Poll;
6
7 struct K;
8 struct E;
9
10 fn as_result() -> Result<(), E> {
11     // From Result
12     let K = Ok::<K, E>(K)?;
13
14     // From Poll<Result>
15     let _: Poll<K> = Poll::Ready::<Result<K, E>>(Ok(K))?;
16
17     // From Poll<Option<Result>>
18     let _: Poll<Option<K>> = Poll::Ready::<Option<Result<K, E>>>(None)?;
19
20     Ok(())
21 }
22
23 fn as_poll_result() -> Poll<Result<(), E>> {
24     // From Result
25     let K = Ok::<K, E>(K)?;
26
27     // From Poll<Result>
28     let _: Poll<K> = Poll::Ready::<Result<K, E>>(Ok(K))?;
29
30     // From Poll<Option<Result>>
31     let _: Poll<Option<K>> = Poll::Ready::<Option<Result<K, E>>>(None)?;
32
33     Poll::Ready(Ok(()))
34 }
35
36 fn as_poll_option_result() -> Poll<Option<Result<(), E>>> {
37     // From Result
38     let K = Ok::<K, E>(K)?;
39
40     // From Poll<Result>
41     let _: Poll<K> = Poll::Ready::<Result<K, E>>(Ok(K))?;
42
43     // From Poll<Option<Result>>
44     let _: Poll<Option<K>> = Poll::Ready::<Option<Result<K, E>>>(None)?;
45
46     Poll::Ready(Some(Ok(())))
47 }
48
49 fn main() {
50 }