]> git.proxmox.com Git - rustc.git/blame - src/test/ui/try-poll.rs
New upstream version 1.53.0+dfsg1
[rustc.git] / src / test / ui / try-poll.rs
CommitLineData
416331ca 1// build-pass (FIXME(62277): could be check-pass?)
8faf50e0
XL
2
3#![allow(dead_code, unused)]
8faf50e0
XL
4
5use std::task::Poll;
6
7struct K;
8struct E;
9
10fn 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
23fn 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
36fn 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
49fn main() {
50}